Wednesday, March 7, 2012

Problems with connecting to Sql Server 2005 from Java application, HELP!

Hello, Everybody.

Help me please with one problem which I'm facing with while deploying java server application on my computer (this java app is jBilling). I have configured it as it was said in docs, I have added environment variable CLASPATH as Microsoft documentation said. I'm using SQL Server JDBC driver 1.2 by Microsoft. The result is that I find this message in log file:

2007-05-27 17:21:41,906 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.microsoft.jdbc.sqlserver.SQLServerDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.jdbc.sqlserver.SQLServerDriver))
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:168)
... and so on.

I have copied sqljdbc.jar to lib folder of the server. That's how I specified connection string:

jdbc:microsoftTongue Tiedqlserver://localhost:1434;DatabaseName=Billing;integratedSecurity=false;

Can not think out what to do else. Maybe somebody knows what to do about it?

Many thanks

Looking at your connection string URL:

jdbc:microsoftqlserver://localhost:1434;DatabaseName=Billing;integratedSecurity=false;

You are ending up trying to load the SQL Server 2000 JDBC driver.

The SQL Server 2005 JDBC v1.x driver uses the following connection string URL:

jdbcTongue Tiedqlserver://

So if you would like to use the 2005 JDBC driver (highly recommended over the 2000 JDBC driver), your resulting connection string URL will look like:

jdbcTongue Tiedqlserver://localhost:1434;DatabaseName=Billing;integratedSecurity=false;

Note: I assume you specified the SQL user name and password somewhere else and that the SQL Server instance is running on the same machine as the JBoss application.

Also, are you trying to connect to the DAC port? 1434 is typically reserved for the DAC port. I would recommend connecting to the normal TCP port of 1433 (if default TCP port settings are used).

HTH,

Jimmy

No comments:

Post a Comment