java连接SQL SERVER 2000 SP3

2025-01-03 18:10:14
推荐回答(1个)
回答1:

public String getdbstr()
{
String returndbstr="";
java.util.Properties p = new java.util.Properties();
try{
FileInputStream fs = new FileInputStream("infobirdDB.ini");
p.load(fs);
databaseurl = p.getProperty("databaseurl");
databasename = p.getProperty("databasename");
username = p.getProperty("username");
password = p.getProperty("password");
fs.close();
returndbstr= "jdbc:microsoft:sqlserver://"+databaseurl+":1433;DatabaseName=" + databasename;;
}
catch(Exception e) {
e.printStackTrace();
}
p=null;
return returndbstr;
}