现在的位置: 首页 > 综合 > 正文

Tomcat 部署 时 java.sql.SQLException: No suitable driver found for jdbc:sqlserver 我是怎么解决的

2013年09月12日 ⁄ 综合 ⁄ 共 1836字 ⁄ 字号 评论关闭

Tomcat 部署时候 驱动报错,stack 信息:

java.sql.SQLException: No suitable driver found for jdbc:sqlserver://172.20.0.30:1433;databaseName=SAPDataConvert
    at java.sql.DriverManager.getConnection(DriverManager.java:602)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at com.jhconn.db.ConnectionPool.getNewConnection(ConnectionPool.java:108)
    at com.jhconn.db.ConnectionPool.getConnection(ConnectionPool.java:89)
    at com.jhconn.db.OperateDB.<init>(OperateDB.java:30)

 

我用的MSQL Server 2005  驱动为 sqljdbc.jar 文件。

注意: 这个文件使用时应该注意版本的问题,最容易出现问题。

 

我的建议是不使用这个包。 使用jdt的包

我使用的是:jtds-1.2.4.jar 文件

下载地址为:http://sourceforge.net/projects/jtds/files/

 

我的链接情况为:

URL:jdbc/:jtds/:sqlserver/://your_db_IP/:1433/your_db_name

DRIVER_NAME:  net.sourceforge.jtds.jdbc.Driver

USER: user

PASS: pass

 

就这样就ok啦

 

希望跟我一样的迷茫的朋友 不要再次出现这样的问题。

 

为什么使用jdt:

Why use jTDS?

jTDS is free software. jTDS is released under the terms of the GNU LGPL
, giving you not
only the posibility to debug and tweak it to your own liking but also
to use it in and distribute it with your free or commercial
applications.

The other "free" choices, the JDBC-ODBC bridge and
Microsoft's own JDBC driver are not actually free. If you encounter an
issue with any of them you won't be able to fix it yourself and
response times from both Microsoft and Sun are anything but short.
Also, both of them lack functionality (the Microsoft driver implements
JDBC 2.0, while the bridge is just a JDBC 1.0 implementation) and have
serious stability problems: the bridge crashes the JVM if the ODBC
driver has any problem and Microsoft just has no intention of really
supporting Java/JDBC.

jTDS is also the most performant JDBC driver for both SQL Server and
Sybase. We have an older benchmark result
but we strongly encourage you to download any benchmark published by
commercial JDBC driver vendors and see for yourself. Here are a couple
of benchmarks you could use: JNetDirect's
JDBC Performance Benchmark

and i-net
Software's BenchTest 2.1 for MS SQL Server

.

Anyway, just give it a spin. Get the latest one from
here
and see whether you like it or not.

 

 

【上篇】
【下篇】

抱歉!评论已关闭.