3 Replies Latest reply on Sep 3, 2009 5:27 PM by Maurizio Canton

    JBOSS 4.2.2 and MS SQL 2005

    Maurizio Canton Newbie

      Hi there,
      I just installed JBOSS 4.2.2 and I want to use MS SQL 2005. So this is what I did:
      1. Deleted JBOSS_HOME/server/default/deploy/hsqldb-ds.xml
      2. Copied JBOSS_HOME/docs/examples/jca/mssql-ds.xml to JBOSS_HOME/server/default/deploy.
      3. In the new copy of mssql-ds.xml, I edit the connection-url, user-name and password elements to match my local SQL db instance.
      4. Changed the value of the jndi-name element from MSSQLDS to DefaultDS
      5. Deleted the file JBOSS_HOME/server/default/deploy/jms/hsqldb-jdbc2-service.xml.
      6. Copied JBOSS_HOME/docs/examples/jms/mssql-jdbc2-service.xml into the folder JBOSS_HOME/server/default/deploy/jms
      7. In the new copy of mssql-jdbc2-service.xml, I replaced the string MSSQLDS with DefaultDS
      8. I copied the MSSQL JDBC driver sqljdbc.jar to JBOSS_HOME/server/default/lib.

      When I start JBOSS I get the following error:
      2009-09-03 16:59:34,609 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: Apparently wrong driver class specified for URL: class: com.microsoft.sqlserver.jdbc.SQLServerDriver, url: jdbc:microsoft:sqlserver://;DatabaseName=systinetdb)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)...

      Do you have any suggestion?


        • 1. Re: JBOSS 4.2.2 and MS SQL 2005
          Peter Johnson Master

          Based on the error message:

          Apparently wrong driver class specified for URL: class: com.microsoft.sqlserver.jdbc.SQLServerDriver

          I suspect that the com.microsoft.sqlserver.jdbc.SQLServerDriver class in not present in the sqljdbc.jar. You might double-check the documentation for the sqljdbc.jar file to verify the driver classname.

          • 2. Re: JBOSS 4.2.2 and MS SQL 2005
            Maurizio Canton Newbie

            Thanks! The class is the right one as described by Microsoft to connect to SQL 2005 and it is included in the driver. The driver is in the server/default/lib so it should be found by JBOSS. I don't understand why is not working. Any other idea?


            • 3. Re: JBOSS 4.2.2 and MS SQL 2005
              Maurizio Canton Newbie

              I found the error. File mssql-ds.xml in JBOSS_HOME\docs\examples\jca has the right SQL 2005 class specified but still the SQL 2000 connection-url.

              The SQL Server 2005 JDBC driver has a different URL prefix from the SQL Server 2000 JDBC driver. The SQL Server 2000 JDBC driver uses an URL prefix of "jdbc:microsoft:sqlserver://", while the SQL Server 2005 JDBC driver uses an URL prefix of "jdbc:sqlserver://".