Mike Romero [
http://community.jboss.org/people/romerom] created the discussion
"Trouble with MS SQL 2005 and JBoss 4.0.5 - Tomcat works though?"
To view the discussion, visit:
http://community.jboss.org/message/560946#560946
--------------------------------------------------------------
Hey Guys,
I have a webapp that I'm trying to port from Tomcat to JBoss. There are two
datasources. One is MySQL, one is MSSQL 2005.
I was able to get the MySQL datasource working in JBoss, but MS SQL is giving me the
strangest error. "Connection Refused". I know the error itself isn't
strange at all, it's just that... there is no network or firewall issue. There is no
issue about the SQL server being down or not listening on that port.
Tomcat works. JBoss 4.0.5 doesn't. I haven't tried other versions of JBoss; this
is just the version we use here where I work so I am setting my environment up to match
theirs.
web.xml:
<resource-ref> <description>Helios</description>
<res-ref-name>jdbc/Helios</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>webCheck</description>
<res-ref-name>jdbc/webCheck</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?> <jboss-web>
<resource-ref>
<res-ref-name>jdbc/Helios</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:jdbc/Helios</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/webCheck</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:jdbc/webCheck</jndi-name>
</resource-ref> </jboss-web>
sql-ds.xml:
<local-tx-datasource>
<jndi-name>jdbc/webCheckORIG</jndi-name>
<connection-url>jdbc:sqlserver://hostname.domain.edu:5555;databaseName=dbname</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<user-name>user</user-name>
<password>pass</password>
</local-tx-datasource>
<xa-datasource>
<jndi-name>jdbc/webCheck</jndi-name>
<track-connection-by-tx></track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
<xa-datasource-property
name="ServerName">hostname.domain.edu</xa-datasource-property>
<xa-datasource-property
name="PortNumber">5555</xa-datasource-property>
<xa-datasource-property
name="DatabaseName">dbname</xa-datasource-property>
<xa-datasource-property
name="SelectMethod">cursor</xa-datasource-property>
<xa-datasource-property name="User">user</xa-datasource-property>
<xa-datasource-property
name="Password">pass</xa-datasource-property>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>MS SQLSERVER2005</type-mapping>
</metadata>
</xa-datasource>
I've been through a few different SQL configs in that "sql-ds.xml" file
based on various examples on the web. The problem is always the same - "Connection
Refused".
The problem is that I can connect using SQL Server Management Studio as well as from
within Eclipse when my webapp is started in Tomcat. It's just that for some reason,
JBoss doesn't seem to get it. Another little nugget. Telnet to the port? Nope, that
doesn't work. From a server on the same segment, telnet doesn't work either.
I started out with an older version of "sqljdbc.jar", then upgraded to 2.0, then
3.0, then attempted to use the "jtds" driver. Each of these produce
"Connection Refused". I've tried with and without JNDI as well. Same
problem :( This is truly puzzling.
Any ideas? Is there some compatibility issue between SQL Server 2005 and JBoss 4.0.5? The
one thing I noticed is that the example above uses the type-mapping of "MS
SQLSERVER2005", only, in "standardjbosscmp-jdbc.xml", there is no entry for
2005, only "MS SQLSERVER" and "MS SQLSERVER2000". This leads me to
believe that a newer version of JBoss might have additional support for SQL Server 2005
and that I might just be going against the stream.
Hopefully you guys have some ideas :)
Why does SQL Server Management Studio and Tomcat work? Why does JBoss fail with a
"Connection Refused" similarly to the way Telnet does?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/560946#560946]
Start a new discussion in Datasource Configuration at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]