?? simpleconnection.java
字號:
package DBconnectionPool;
import java.sql.*;
public class SimpleConnection {
Connection con ;
public SimpleConnection() {
try {
/*
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(
"jdbc:odbc:ds",
"sa", "123");
* */
Class.forName("org.gjt.mm.mysql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","xujingxi","networkgb2312");
} catch (Exception e) {
e.printStackTrace();
}
}
public Connection getConnection(){
return con;
}
public void release(){
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void test(){
try{
Statement sm=con.createStatement();
String sql="insert into mb_UserBaseInfo(vc_UserAccount, vc_PassWord,vc_NickName,vc_EMail,vc_QQ)values("+
3+","+2+","+2+","+2+","+2+");";
int result=sm.executeUpdate(sql);
System.out.println(result);
}catch(Exception e){
System.out.println(e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -