连接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就可以了