小弟初学java! 发篇贴子和大家讨论讨论! 你是怎么学的呢?我也是刚开始学JAVA的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你学JAVA多长时间了,还初学者。看不懂。但支持你,天才. public ReadDb(String Driver) throws Exception { this.Driver = Driver; this.userName = null; this.passWord = null; this.dbName = null; this.dbAddress = "localhost"; init(); } public ReadDb(String Driver, String address) throws Exception { this.Driver = Driver; this.userName = null; this.passWord = null; this.dbAddress = address; init(); } public ReadDb(String Driver, String address, String dabaseName) throws Exception { this.Driver = Driver; this.userName = null; this.passWord = null; this.dbName = null; this.dbAddress = "localhost"; this.dbName = dabaseName; init(); } public ReadDb(String Driver, String address, String dabaseName, String name) throws Exception { this.Driver = Driver; this.userName = name; this.passWord = null; this.dbAddress = address; this.dbName = dabaseName; init(); } public ReadDb(String Driver, String address, String dabaseName, String name, String pw) throws Exception { this.Driver = Driver; this.userName = name; this.passWord = pw; this.dbAddress = address; this.dbName = dabaseName; init(); } private void init() throws Exception { if (this.Driver.equals("com.microsoft.jdbc.sqlserver.SQLServerDriver")) this.url = "jdbc:microsoft:sqlserver://" + this.dbAddress + ";DatabaseName=" + this.dbName; else if (this.Driver.equals("oracle.jdbc.driver.OracleDriver")) this.url = "jdbc:oracle:thin:@" + this.dbAddress + ":1521:" + this.dbName; else if (this.Driver.equals("com.ibm.db2.jdbc.app.DB2Driver")) this.url = "jdbc:db2://" + this.dbAddress + ":5000/" + this.dbName; else if (this.Driver.equals("com.informix.jdbc.IfxDriver")) this.url = "jdbc:informix-sqli://" + this.dbAddress + "/" + this.dbName + ":INFORMIXSERVER=myserver"; else if (this.Driver.equals("com.sybase.jdbc.SybDriver")) this.url = " jdbc:sybase:Tds:" + this.dbAddress + ":5007/" + this.dbName; else if (this.Driver.equals("org.gjt.mm.mysql.Driver")) this.url = "jdbc:mysql://" + this.dbAddress + "/" + this.dbName + "?user=" + this.userName + "&password=" + this.passWord + "&useUnicode=true&characterEncoding=8859_1"; else if (this.Driver.equals("org.postgresql.Driver")) this.url = "jdbc:postgresql://" + this.dbAddress + "/" + this.dbName; else { throw new Exception("UNKNOW DATABASE DRIVER"); } } 纠错~ 请各位大神 帮帮忙 字符串 转 日期的 基础问题 数据库连接异常,怎么看sql2000端口号 没得分了.求高手指教,改天再开贴送兄弟分 怎样改变swing默认策略保存输入值的问题 小弟有一道习题,实在不行了,我只能编出框架来,调用接口监听和文件存取时总是出错,不知道为什么? 哪位好心的大哥给编一下,小弟这里谢过 如何读取一个inputstream两遍 如何让控件有闪动效果? JAVA大于4多串口的类库在哪有下载? java3d ??高手帮忙 求救java 连接 mysql 问题 怎样把URI的参数转换成汉字
看不懂。
但支持你,天才.
this.Driver = Driver;
this.userName = null;
this.passWord = null;
this.dbName = null;
this.dbAddress = "localhost";
init();
} public ReadDb(String Driver, String address) throws Exception {
this.Driver = Driver;
this.userName = null;
this.passWord = null;
this.dbAddress = address;
init(); } public ReadDb(String Driver, String address, String dabaseName)
throws Exception {
this.Driver = Driver;
this.userName = null;
this.passWord = null;
this.dbName = null;
this.dbAddress = "localhost";
this.dbName = dabaseName;
init();
} public ReadDb(String Driver, String address, String dabaseName, String name)
throws Exception {
this.Driver = Driver;
this.userName = name;
this.passWord = null;
this.dbAddress = address;
this.dbName = dabaseName;
init(); } public ReadDb(String Driver, String address, String dabaseName,
String name, String pw) throws Exception {
this.Driver = Driver;
this.userName = name;
this.passWord = pw;
this.dbAddress = address;
this.dbName = dabaseName;
init(); } private void init() throws Exception {
if (this.Driver.equals("com.microsoft.jdbc.sqlserver.SQLServerDriver"))
this.url = "jdbc:microsoft:sqlserver://" + this.dbAddress
+ ";DatabaseName=" + this.dbName;
else if (this.Driver.equals("oracle.jdbc.driver.OracleDriver"))
this.url = "jdbc:oracle:thin:@" + this.dbAddress + ":1521:"
+ this.dbName;
else if (this.Driver.equals("com.ibm.db2.jdbc.app.DB2Driver"))
this.url = "jdbc:db2://" + this.dbAddress + ":5000/" + this.dbName;
else if (this.Driver.equals("com.informix.jdbc.IfxDriver"))
this.url = "jdbc:informix-sqli://" + this.dbAddress + "/"
+ this.dbName + ":INFORMIXSERVER=myserver";
else if (this.Driver.equals("com.sybase.jdbc.SybDriver"))
this.url = " jdbc:sybase:Tds:" + this.dbAddress + ":5007/"
+ this.dbName;
else if (this.Driver.equals("org.gjt.mm.mysql.Driver"))
this.url = "jdbc:mysql://" + this.dbAddress + "/" + this.dbName
+ "?user=" + this.userName + "&password=" + this.passWord
+ "&useUnicode=true&characterEncoding=8859_1";
else if (this.Driver.equals("org.postgresql.Driver"))
this.url = "jdbc:postgresql://" + this.dbAddress + "/"
+ this.dbName;
else {
throw new Exception("UNKNOW DATABASE DRIVER");
}
}