jdbc

zdf312 zdf312 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
public class Base {

/**
* @param args
*/
public static void main(String[] args) {
static void template() throws Exception {
String url="jdbc:mysql://localhost:3306/jsbc";
String user="root";
String password="admin";
Connection conn=null;
Statement st=null;
ResultSet rSet=null;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url,user,password);
st=conn.createStatement();
rSet=st.executeQuery("select * from user");
while(rSet.next()){
System.out.println(rSet.getObject(1)+"\t"+rSet.getObject(2)
+"\t"+rSet.getObject(3)+"\t");
}
}finally{
try{
if(rSet!=null)
rSet.close();
}finally{
try{
if(st!=null)
st.close();
}finally{
if(conn!=null)
conn.close();
}
}
}
}
}
请问这段代码哪里出问题啦,我拿myeclipse7.0运行老是出错,提示‘{’有问题,不懂。
...全文
评论 15
收藏 已收藏
分享
返回顶部
zdf312
Web 开发 81,108 成员 341,721 内容