Connection problem in Win2k3 server 64 bit with JDBC
DriverManager#getConnection()
returns null
when I am deploying my JSP/Servlet package in a Windows 2003 Server environment (64开发者_运维问答 bit). The database is Microsoft SQL 2005 Enterprise Edition.
The code is:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:calsoft2k","xxx","xxx");
The same code is working without any problems in Windows XP (32 bit) box. I am using Apache Tomcat 6.X server in both production and development environment.
Any pointers?
Use a real JDBC driver instead of the (pardon me) lousy ODBC bridge driver.
Decent DB vendors supplies their own JDBC drivers. The one for SQL2005 can just be found at microsoft.com. This driver is however known not to be very optimal in both the performance and the level of JDBC API support. You could also consider the much faster and better jTDS driver instead.
精彩评论