小弟刚开始学,很多看不明白,请各位帮忙注释一下,谢谢了!这是个数据库连接池~packagedda;importjava.sql.*;importjava.io.LineNumberReader;importjava.io.FileReader;importjava....
小弟刚开始学,很多看不明白,请各位帮忙注释一下,谢谢了!这是个数据库连接池~ package dda;import java.sql.*;import java.io.LineNumberReader;import java.io.FileReader;import java.util.StringTokenizer;public class DbConnection{ Connection conn = null; ResultSet rs = null; boolean b ; public DbConnection(){ this.b = false; this.getDBConfig(); } String strSeparate = " "; String strFileName = "DBConfig.txt"; String strUserID = null; String strUserPWD = null; String strDB = null; public void getDBConfig(){ //this.getDBConfig(); try{ LineNumberReader oLineNumberReader = new LineNumberReader(new FileReader(this.strFileName)); String strLine = null; while((strLine = oLineNumberReader.readLine()) != null){ StringTokenizer token = new StringTokenizer(strLine,(new String(this.strSeparate).toString())); this.strDB = token.nextToken(); this.strUserID = token.nextToken(); this.strUserPWD = token.nextToken(); } }catch(Exception e){ //System.out.println("DB:"+strFileName); } } /**
鏁版嵁搴撹繛鎺
展开