Driver.getConnection hangs using SQLServer driver and Java 1.6.0_29 - java

I didn't know where to write something about this and decided to do it here.
After loooong time debugging my program I could find out that calling Driver.getConnection(string, string, string) hangs the calling thread. Why(?), I really don't know, but I could find out that this happens with java 1.6.0_29 and not with java 1.6.0_26.
Full enviroment:
OS: Tested on both redhat 6.1 and Windows 2008
Driver: MS SQL Server JDBC Driver version 3.0.1301.101
Java Versions: 1.6.0_26 and 1.6.0_29
As I previously told it works with 1.6.0_26.
Is there anyone that has any idea what's possibly causing this? Maybe some developer? :p
Best regards,
Rui

I encountered exactly the same behaviour:
I use both Oracle XE and MS SQL Server Express on my Windows 7 64bit PC - I upgraded to java 1.6.0_29 from 1.6.0_27 (the x64 version) and was surprised to see that the same programs where able to connect to Oracle XE but not to MS SQL Server...
I traced down the problem to javax.sql.DataSource.getConnection() where it was hanging forever - because this is just an interface, the jdbc drivers raised my suspicion...
I'm using the MS SQL Server JDBC Driver 3.0.1301.202 and I even updated to SQL Server CTP (the "community technical preview") 4.0.1722.1 because my suspicion was that it has to do something with the jdbc driver - but no success: still hanging!
My workaround was to downgrade to 1.6.0_27 and -- bang: everything was fine again!
best regards
Erich

Reproduced:
Problem occurs with combination of
SQL driver 2.0
SQL driver 3.0
SQL driver 4.0 CTP 3
jTDS SQL Driver 1.2.5
SQL server 2008R2
Java 1.6.0_29
Change either SQL server version (tested on 2005 & 2008) or Java version (1.6.0_27, 1.7.0_1), and the problem doesn't occur anymore.
Client / Server OS: Windows 2008R2
Added to the Java Bug Database and is being worked on by Oracle.
Crossposted on Microsoft MSDN Data Access Forum (accepted answer: upgrade to java 7) and Oracle Java JDBC Forums (information that is added here, is also added to the Java Bug Database).

See the solution here
https://forums.oracle.com/forums/thread.jspa?messageID=9954398&tstart=0
http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/97dce8fd-6487-4bca-80b0-492167db3e0d
"Apparently, this is related to SSL use and can be mitigated by replacing the jsse.jar in the jre/lib with that from an earlier version, for instance out of the 1.6.0_27 release. I've been confused by 1.6.0_29 working with MS JDBC and older SQL Server '05 setups which are not doing secure connections. All the newer servers (SQL Server '08 R2) fail as they require SSL and Java 1.6.0_29 does not work using jTDS or MS JDBC in this case."

As an FYI, it appears that there's a new step build #30 in the 1.6 family which fixes the issue:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7103725

I have the same hang problem, and only with java 1.6.0_29. I noticed that if I upgrade to 7.1 the problem goes away

I am so happy that I have found this forum. I had the same problem on upgrade (I actually upgraded from 1.6.0_22 to 1.7.1, then downgraded to 1.6.0_29, when the problem has occurred.
One more thing I have noticed : if I use 1.6.0_29 jre, it fails, but if I use 1.6.0_29 jdk, it works... I spent about a day trying to figure why eclipse (which was using the jre) was failing while myEclipse (which was using the jdk) was working....
How can a bug be introduced to such a late release ? (I am in the process of making a java production version recommendation).

Same problem here (SQLJDBC4, MsSQL 2008 R2, JDK1.6.0.29), but after updating to 1.6.0.30 problem was solved...
So it should be a critical bug in the DriverManager of 1.6.0.29

Upgrading to 1.6.0_30 also worked for me. Microsoft has released a statement announcing the fix in 2012 Q1. It looks like it's a Java vulnerability (BEAST).

I had the exact same issue where jBoss would hang on driver.getConnection(). However, I was using jBoss EAP 5.1, java 1.6.0_37x64, Sql Server 2005, and jtds1.2.5 as my jdbc driver.
The work around I had to use was a jvm setting at startup: -Djsse.enableCBCProtection=false and that resolved it.
I don't consider this a fix, but rather a work-around at this point.
I did find a bug: 7105007 : Microsoft & jTDS JDBC driver broken after update to 1.6.0_29 that was very similar, but had a different cause. What was interesting was that it showed up on both the MS drivers and jtds drivers.

Related

Netbeans cannot connect to MSSQL

I don't know if this is the right place to ask, but I have search everywhere for the solution to this problem.
I used to have Netbeans 8.0 32-bit, Java 7 32-bit and MSSQL 2012. I already set up several connection in Server/Database in Netbeans and it was working perfectly. When I install Android Studio it required 64-bit version of Java so I uninstall my old version and install Java 8 64-bit. But Netbeans cannot detect the new version so I uninstall it and install Netbeans 8.1 64-bit. But when I try to connect using my old connection or even create new one, it always say: "Unable to connect. Connection refuse: connect. Verify the connection properties." My access to MSSQL stay the same, using the same username and password, already check the TCP/IP of MSSQL to be 1433, and turn off windows firewall. The only thing I don't know how to check is the host, which used to be 127.0.0.1.
Any way to solve this problem? Should I reverse my Java and Netbeans to 32-bit? Appreciate any help
Connecting to MSSQL using NetBeans
Follow the steps given in this link
More resources which are available on SO are here
One thing to note here is that the JDBC-ODBC Bridge has been removed from Java 8.

Routine (get_data_type) can not be resolved

I've just updated the informix jdbc driver on my application (from 3.0 to V4.10.JC4DE) and the following error occurred, when trying to connect with informix 9.
java.sql.SQLException: Routine (get_data_type) can not be resolved.
at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3130)
at com.informix.jdbc.IfxSqli.D(IfxSqli.java:3412)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2325)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2250)
at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1485)
at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1465)
at com.informix.jdbc.IfxResultSet.a(IfxResultSet.java:211)
at com.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java:1064)
at com.informix.jdbc.IfxStatement.executeQuery(IfxStatement.java:236)
at com.informix.jdbc.IfxDatabaseMetaData.getColumns(IfxDatabaseMetaData.java:3549)
at com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getColumns(NewProxyDatabaseMetaData.java:3968)
at org.hibernate.tool.hbm2ddl.TableMetadata.initColumns(TableMetadata.java:197)
at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:58)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:113)
... 54 more
The new driver works fine with Informix 11. Unfortunately, I have to support connection with Informix 9.
Unfortunately, Informix 9 is a very very old engine. I think you should upgrade (or tell your clients to upgrade) to a newer - and supported - version. A simple upgrade should give them lots of new features, better performance (at least 40% more), and of course, a more stable engine.
Actually it really does not support version 9. On the product Release Notes page, you will see that:
"To use IBM Informix JDBC Driver to connect to an IBM Informix database, you must use one of the following IBM Informix database servers:
Version 11.50, 11.70, or 12.10
IBM Informix Extended Parallel Server, Version 8.3 or later
"

java 1.6 and 1.7 to connect to sql server 2000

i have written a Gui application in java and all is working fine when connecting to SQL 2008 with the jdbc4 API. however i now need to connect to SQL 2000. i have downgraded to jdbc driver 3 but that is incompatible with java 1.6/7 and requires v 1.5 .
is there any way to get the newer versions of java to connect to old SQL 2000.
Have a look at this page. JDBC driver 3.0 with JRE 7 compatibility.
http://www.microsoft.com/en-in/download/details.aspx?id=28562
or have a look at jTDS.
http://jtds.sourceforge.net/
Reading these posts may also help.
How to make Java work with SQL Server?
java.sql.SQLException: SQL Server version 8 is not supported by this driver. SQL State = 08S01, Error Code = 0

Strange performance Issue with SQL Server + Spring JAVA application

I am experience a strange performance issue when accessing data from SQL Server from a Spring based application. In my current setup, the Spring java application runs on a separate machine accessing data from a remote SQL Server DB. I am using NamedParameterTemplate in Spring, which I believe uses Prepared Statement to execute the query. For some reason, some of the query takes a long time to complete (approx. 2 mins). The JAVA app runs on a 64bit machine running 64bit version of Java v1.6, and the SQL Server is MS SQL Server 2008 R2.
The strangeness, is if I run the same java app from my laptop running Windows XP 32bit, running the same version of Java v1.6, the query takes less than a second, accessing the exact same remote DB server (infact, I am connected through VPN)
This shows the issue is not with the Spring framework but may be with the SQL JDBC Driver. I am using Microsoft JDBC Driver 4.0 for SQL Server (sqljdbc.jar)
I am completely clueless, as what could possibly be wrong and not sure where to start my debugging process.
I understand, there isn't much information in my question, so please let me know if you need any specific detail.
Thanks for any help/suggestions.
I think this may be due to the combination of your java version and jdbc driver failing to handshake the connection with the server. See Driver.getConnection hangs using SQLServer driver and Java 1.6.0_29 and http://blogs.msdn.com/b/jdbcteam/archive/2012/01/19/patch-available-for-sql-server-and-java-6-update-30.aspx
If so, switching to 1.6.0 upgrade 30 or higher and applying kb 2653857 ought to fix it.

Connection problem in Win2k3 server 64 bit with JDBC

DriverManager#getConnection() returns null when I am deploying my JSP/Servlet package in a Windows 2003 Server environment (64 bit). The database is Microsoft SQL 2005 Enterprise Edition.
The code is:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:calsoft2k","xxx","xxx");
The same code is working without any problems in Windows XP (32 bit) box. I am using Apache Tomcat 6.X server in both production and development environment.
Any pointers?
Use a real JDBC driver instead of the (pardon me) lousy ODBC bridge driver.
Decent DB vendors supplies their own JDBC drivers. The one for SQL2005 can just be found at microsoft.com. This driver is however known not to be very optimal in both the performance and the level of JDBC API support. You could also consider the much faster and better jTDS driver instead.

Categories