Problem connecting SQL server using Spring

I found a problem connecting my web application using JDBC or Spring to a SQLServer database (not Express).

At some point in my code, I call:

this.conn = DriverManager.getConnection(db_connect_string, db_userid, db_password); 

and the application works correctly, but it waits and does not continue. The same thing happens with another web application:

 getJdbcTemplate().query(...) 

If I look at db using:

 SELECT SPID, STATUS, PROGRAM_NAME, LOGINAME=RTRIM(LOGINAME), HOSTNAME, CMD FROM MASTER.DBO.SYSPROCESSES WHERE DB_NAME(DBID) = 'myDB' AND DBID != 0 

I see that there is a connection, but "AWAITING COMMAND". No exception is handled; it just waits for something.

The SQL Server profiler for this connection (audit login) returns:

 -- network protocol: TCP/IP set quoted_identifier on set arithabort off set numeric_roundabort off set ansi_warnings on set ansi_padding on set ansi_nulls on set concat_null_yields_null on set cursor_close_on_commit off set implicit_transactions off set language us_english set dateformat mdy set datefirst 7 set transaction isolation level read committed 

It works until a few weeks ago. I think this should be related to the configuration of SQLServer, but I am pretty sure that I have not changed anything. We can eliminate the problem with the firewall, because the connection is correctly created. Can anyone help me please?

thanks Andrea

+4
source share
1 answer

As suggested by Mark Rotteveel , this is a Java 1.6.0_29 bug.

0
source

Source: https://habr.com/ru/post/1392942/


All Articles