Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot load JDBC driver class
<
property
name
="url"
>
<
value
>
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs
</
value
>
</
property
>
<
property name
=
"
url
"
>
<
value
>
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs</value>
</
property
>
Struts+Spring+hibernate报以上错时,请在"applicationContext.xml"配置文件中将下面代码
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
改成
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
The problem is quite simple - the class driver cannot be found in the classpath. However, from the looks of the stacktrace is seems that the classname might involve some blanks and ' characters.
Make sure that when you specify your jdbcDriver class, no 'extra' characters are specified.
Make sure that when you specify your jdbcDriver class, no 'extra' characters are specified.
千万别笑!格式不同!<value></value>必须同一行,并且中间不能有空格或其他多余字符!
这个方法同样适用于jtds的连接字符串
如果大家遇到这样的问题,不防也这样试一试!