jdbc
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运行老是出错,提示‘{’有问题,不懂。
/**
* @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运行老是出错,提示‘{’有问题,不懂。
...全文
相关推荐
Spring Data JDBC与JDBC的区别
JDBC规范 java.sql和javax.sql两个包中的类与接口(天龙八部): DataSource:数据源 DriverManager:驱动管理 Driver:JDBC驱动 Connection:数据库连接 Statement:语句,执行SQL PrepareStatement:预编译语句,性能更好 CallableStatement:调用存储过程 ResultSet:结果集,封装了多条记录 JDBC数据库连接池/Connection Pool DBCP:apache tomcat内置
jdbc 连接impala或者jdbc连接hive
jdbc 连接impala或者jdbc连接hive所需的jar包。
JDBC由浅入深-一本很详细的JDBC开发书籍
这是一本由我编写的JDBC书籍,其中详细的讲述了关于JDBC的用法,希望大家能够喜欢
JDBC6和JDBC14
JDBC连接数据库JAR包,可以为多种关系数据库提供统一访问,它由一组用Java语言编写的类和接口组成。
jdbc jdbc jdbc
jdbc jdbc jdbc jdbc jdbc jdbc jdbc jdbc


Web 开发
