0

So basically, I'm having trouble connecting to SQL Server 2012 through JDBC through my tomcat web application and also SQuirreL

I've tried substituting multiple versions of sqljdbc jar files. The weird thing is, my co-worker is able to successfully connect!

Also, all jars successfully connect to a different SQL Server 2005.

SQL Server Management Studio 2005 express (on my machine) connects to both SQL Server 2005 & 2012 without issue.

Tomcat Resource setting:

<Resource auth="Container" description="a Database Connection" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" logAbandoned="true" maxActive="300" maxIdle="50" maxWait="10000" name="jdbc/SomethingPool" password="PW" removeAbandoned="true" removeAbandonedTimeout="60" type="javax.sql.DataSource" url="jdbc:sqlserver://<SOMETHING>.<DOMAIN>.com:1433;databaseName=dbname;" username="USER"/>

old SQL JDBC version (sorry, don't know how to check versions):

  • SQuirreL test connect- times out
  • SQuirreL connect - times out
  • Tomcat - times out
  • other developer SQuirreL - SUCCESS!
  • other developer Tomcat - SUCCESS!
  • SQL Server 2005 SQuirreL - SUCCESS!

new SQL JDBC version (downloaded recently from http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx):

  • SQuirreL test connect- SUCCESS! also weird
  • SQuirreL connect - times out
  • Tomcat - com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.
  • other developer SQuirreL - N/A
  • other developer Tomcat - N/A
  • SQL Server 2005 SQuirreL - SUCCESS!

My machine

  • Windows 7
  • SQuirreL 3.5.0
  • Tomcat 6.0.18
  • Java 1.6.0_29
  • connection string: jdbc:sqlserver://..com:1433
  • SQL Server Management Studio Express 2005

Server:

  • Windows Server 2012 R2
  • SQL Server 2012 (2005 compatibility)

Old Server:

  • Windows Server 2003 R2
  • SQL Server 2005

Thanks!

patlv23
  • 113
  • 2
  • 11

1 Answers1

0

What is the SQL Statement? Since you got this error from Tomcat (com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.) does the SQL statement work directoy in MSSQL 2012 Server Management Studio. Just try something simple like (SELECT 1) and see if that works.

On Tomcat please provide the Resource configuration. You could try using the built in connection pool that Tomcat provides.

factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"

Since it is a timeout you could be having a network problem. Does ping work successfully? Can you telnet to 1433 and see if a firewall is blocking your connection?

Joe
  • 1,219
  • 8
  • 13
  • yes I am able to ping the server. I will update my posting with the config. Again though, it works in another developers machine – patlv23 Feb 05 '14 at 18:12