当前位置: 技术问答>java相关
jsp怎么通过jdbc连接db2数据库?
来源: 互联网 发布时间:2015-03-25
本文导语: | String sDBDriver="com.ibm.db2.jdbc.app.DB2Driver"; private Connection conn = null; public Connection DBConnect(){ try{ conn = DriverManager.getConnection(sConnStr,user,pwd); } catch (SQLException e){ System.er...
|
String sDBDriver="com.ibm.db2.jdbc.app.DB2Driver";
private Connection conn = null;
public Connection DBConnect(){
try{
conn = DriverManager.getConnection(sConnStr,user,pwd);
} catch (SQLException e){
System.err.println(e.getMessage());
} finally{
return conn;
}
}
}
你要从IBM的网站上下载com.ibm.db2.jdbc.app.DB2Driver
然后加载到你的ClassPath上
private Connection conn = null;
public Connection DBConnect(){
try{
conn = DriverManager.getConnection(sConnStr,user,pwd);
} catch (SQLException e){
System.err.println(e.getMessage());
} finally{
return conn;
}
}
}
你要从IBM的网站上下载com.ibm.db2.jdbc.app.DB2Driver
然后加载到你的ClassPath上