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.