连接数据库Dao类
我用的是sql2005的怎么都连不上查到说是应为这个语句是2000的要怎么改啊publicclassDao{protectedstaticStringdbClassNam...
我用的是sql2005的 怎么都连不上 查到说是应为这个语句是2000的 要怎么改啊
public class Dao {
protected static String dbClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
protected static String dbUrl = "jdbc:sqlserver://localhost:1433; DatabaseName=db_library";
protected static String dbUser = "sa";
protected static String dbPwd = "1234";
protected static String second = null;
private static Connection conn = null;
private Dao() {
try {
if (conn == null) {
Class.forName(dbClassName).newInstance();
conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd); 展开
public class Dao {
protected static String dbClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
protected static String dbUrl = "jdbc:sqlserver://localhost:1433; DatabaseName=db_library";
protected static String dbUser = "sa";
protected static String dbPwd = "1234";
protected static String second = null;
private static Connection conn = null;
private Dao() {
try {
if (conn == null) {
Class.forName(dbClassName).newInstance();
conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询