Jquery中文網 伊蒂哈德7比2 www.jvkwgx.com.cn
Jquery中文網 >  腳本編程  >  java  >  正文 JAVA:數據庫操作封裝

比艾因伊蒂哈德:JAVA:數據庫操作封裝

發布時間:2019-10-07   編輯:伊蒂哈德7比2 www.jvkwgx.com.cn
jquery中文網為您提供JAVA:數據庫操作封裝等資源,歡迎您收藏本站,我們將為您提供最新的JAVA:數據庫操作封裝資源
<script>ec(2);</script>
package creator.common.db;
import java.io.InputStream;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
/**
*
* <p>Title: dbBean.java</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author TanBo
* @version 1.0
*/
public class DbBean {
public java.sql.Connection conn = null; //connection object
public ResultSet rs = null; //resultset object
public Statement stmt = null; //statement object
public PreparedStatement prepstmt = null; //preparedstatement object
private String drivers = null; //connection parameter:drivers
private String url = null; //connection parameter:url
private String user = null; //connection parameter:user
private String password = null; //connection parameter:password
private String jndi_name = null; //connection pool parameter:jndi name
/**
* init()
*/
public DbBean(){
try{
//parameter init
drivers = creator.config.ConfigBundle.getString("drivers");
url = creator.config.ConfigBundle.getString("url");
user = creator.config.ConfigBundle.getString("user");
password = creator.config.ConfigBundle.getString("password");
jndi_name = creator.config.ConfigBundle.getString("jndi_name");
//db connection pool init
//InitialContext env = new InitialContext();
//javax.sql.DataSource pool = (javax.sql.DataSource)env.lookup(jndi_name);
//conn = pool.getConnection();
//db connection init
Class.forName(drivers);
conn = DriverManager.getConnection(url,user,password);
//db statement init
stmt = conn.createStatement();
}catch(Exception e){
System.out.println("dbBean: init error!" e.toString());

伊蒂哈德7比2 www.jvkwgx.com.cn 您可能感興趣的文章:
NoSQL數據庫之MongoDB入門詳解
DB2基礎知識(2)DB2數據庫的安裝
DB2常用知識
jQuery的UI插件 Smart UI
jquery的ajax簡單結構示例代碼
db2常用命令大全-基礎篇
jsp連接Sql Server7.0/2000數據庫
用緩沖技術提高JSP應用的性能和穩定性
jquery中ajax函數執行順序問題之如何設置同步
通過實例了解PHP的mvc開發

[關閉]