在使用java连接服务器时出错:org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null',是什么原因?
解决方案 »
- html页面大小和浏览器全屏以及显示器分辨率关系
- struts2的Iterator,property标签问题
- hibernate自动生成的dao里的findByProperty查询不成
- 新建了一个页面,可是为什么浏览不到页面
- 错误在那里???
- 请各位大侠帮我找一些java与数据库联接的资料
- 我是新手,这个问题还请高手指点,不会吝啬分数的:)
- 如何得到一月有多少天?
- 我试了,当执行*.shtml文件时,他要求我下载,而且他根本不执行相应的servlet!!!
- 求助啊,用eureka restAPI注册服务的时候一直给我报400cannot parse request body
- 如何进行反编译
- 改了个jsp页面,不能提交
public class TestSQL2005
{
private Connection con=null;
//使用SQL 2000时三个包放在C:\Program Files\Java\jdk1.5.0_09\jre\lib\ext中
private static final String DRIVER="com.microsoft.jdbc.sqlserver.SQLServerDriver";
private static final String URL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=netshop";//netshop 是数据库名
String us="sasa";//us是用户名
String pw="123456";//密码
public void testConnection()
{
try
{
Class.forName(DRIVER);
con=DriverManager.getConnection(URL,us,pw);
System.out.print("Connection Successfull!");
if(con!=null)
{
System.out.println("OK!");
con.close();
}
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
catch(SQLException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
new TestSQL2005().testConnection();
}
}