dbaccess.java

来自「农业银行ATM对帐查询系统后台类包的源代码,实现了FTP,数据库管理等等功能」· Java 代码 · 共 70 行

JAVA
70
字号
package boco.shabank.dbconnection;//数据库连接池的建立/** * <p>Title: dbmanager</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: boco</p> * @author xugs * @version 1.0 */import java.sql.*;import java.io.*;import java.util.*;import COM.ibm.db2.jdbc.net.DB2Driver;//import boco.DBManager.DBConnect.DBConnectionManager;/* This class consist of these methods:getColumnLabels,getColCount, * getRowCount,getCell,updateData,selectData etc. */public class DBAccess{        int rows;        int cols;        Vector result;        String ErrString = "";        //ResultSet rs = null;        DBConnectionManager objDBConnection;        DBConnectionAny objDBConn;        public DBAccess() {           //objDBConnection = objDBConnection.getInstance();        }        public DBAccess(String dbsname){            //objDBConn.release() ;            objDBConn.getInstance(initConnPool(dbsname));        }        public String GetColumnLabels(int col) {                String[] s = (String[])result.firstElement();                return s[col];        }        public int GetColCount(){                return cols;        }        public int GetRowCount(){                return rows;        }        public String GetCell(int col,int row){                String[] s=(String[])result.elementAt(row);                return s[col];        }        /**   This method updateData        *    @param (Connection m_connection,String sql)        *    @return void        *    @throws exception :ClassNotFoundException,SQLException        */        public int executeUpdate(Connection m_connection,String sql)        throws ClassNotFoundException,SQLException{                   Statement stmt=m_connection.createStatement();                   int j = stmt.executeUpdate(sql);                   return j;        }        public ResultSet executeQuery(Connection m_connection,String sql) throws ClassNotFoundException,SQLException{                Statement stmt=m_connection.createStatement();                ResultSet rs = stmt.executeQuery(sql);                return rs;        }        /**   This method selectData 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?