Tomcat 部署 時 java.sql.SQLException: No suitable driver found for jdbc:sqlserver 我是怎麼解決的

來源:互聯網
上載者:User

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.

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.