81,077
社区成员




public class Base{
/**
* @param 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();
}
}
}
}
public static void main(String[] args) throws Exception{
template();
}
}