日期:2014-05-18  浏览次数:20722 次

连接sqlserver2000出现无效url错误
import   java.sql.*   ;

public   class   DataBaseConnection
{
private   String   DBDRIVER =   "com.microsoft.jdbc.sqlserver.SQLServerDriver "   ;
private   String   DBURL =   "jdbc:microsoft:sqlserver://http:localhost:1433;DatebaseName=carey ";
private   String   DBUSER =   "sa "   ;
private   String   DBPASSWORD =   " "   ;
private   Connection   conn =   null   ;

public   DataBaseConnection()
{
try
{
Class.forName(DBDRIVER)   ;
this.conn   =   DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD)   ;
}
catch   (Exception   e)
{
}
}
public   Connection   getConnection()
{
return   this.conn   ;
}
public   void   close()
{
try
{
this.conn.close()   ;
}
catch   (Exception   e)
{
}
}
}

//使用以上代码连接sql2000数据库出现“无效的url”错误问题,

请各位赐教!!



------解决方案--------------------
private String DBURL = "jdbc:microsoft:sqlserver://localhost:1433;DatebaseName=carey ";

------解决方案--------------------
不要http
------解决方案--------------------
"jdbc:microsoft:sqlserver://http:localhost:1433;DatebaseName=carey ";
-------------把://http去掉试下!
------解决方案--------------------
没有//http
------解决方案--------------------
去掉://http就可以了