views:

176

answers:

2

i have deployed my application on jboss 3.I have restored a database back up of sql server 2000 on sql server 2005.then i have downloaded the jr file jdbc connection to sql server 2005.My connection string setting is as below.

    <datasources>
<local-tx-datasource>
 <jndi-name>SLBDataSource</jndi-name>
 <connection-url>jdbc:sqlserver:\\RAVIGARG\SQLSERVER2005;DatabaseName=Sahil_test_12_12_09;SelectMethod=cursor</connection-url>
 <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>

 <min-pool-size>10</min-pool-size>
 <max-pool-size>100</max-pool-size>
 <user-name>sa</user-name>
 <password>sa</password>
</local-tx-datasource>

But i am getting exception as below.

    WARN  [JBossManagedConnectionPool] Throwable while attempting to get a new      connection:
       org.jboss.resource.JBossResourceException: Could not create connection; -  nested  throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]   Unable to connect.  Invalid URL.)
+2  A: 

According to Building the Connection URL, the general form of a connection url is

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]

So, if RAVIGARG is ther server name, try something like this instead (note the forward slashes):

jdbc:sqlserver://RAVIGARG\SQLSERVER2005;databaseName=Sahil_test_12_12_09;SelectMethod=cursor

PS: According to the stracktrace, you are using a JDBC driver for SQL Server 2000. This is not the root cause of the problem but maybe you should consider upgrading it as you are using SQL Server 2005. If you do so, note that the driver class name is com.microsoft.sqlserver.jdbc.SQLServerDriver so update your <driver-class> accordingly. See SQL Server 2005 JDBC Driver Documentation.

Pascal Thivent
Thanks.I have replaced jar file for jdbc driver in lib of jboss but i think i need to make change for jdbc driver somewhere else too.can u pls tell me where shd i make change to upgrade jdbc driver to 2005.
Maddy.Shik
I think you need to update your driver-class. I've updated my answer.
Pascal Thivent
+1  A: 

Just a suggestion: you might want to use jTDS instead. It is much more stable than Microsoft's drivers, delivers great performance and works with all kinds of flavors of SQL Server. We've been using it on our production servers for years.

This would be the appropriate connect string:

jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]

You can find out everything about driver names etc. in the jTDS FAQ.

torbengee