Skip to content

Problem connecting from macOS to SQL Azure #177

@diegolesli

Description

@diegolesli

Hello,

When connecting to a SQL Azure database from mac I am getting the error below running the connectURL example.

mvn -q exec:java -Dexec.mainClass=com.sqlsamples.App -P connectURL

Output

com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server did not return a response. The connection has been closed. ClientConnectionId:8de59301-094c-4f5e-bad9-83142d15c249
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2392)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2376)
	at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:6680)
	at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7993)
	at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7945)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4375)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3188)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:61)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3151)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7535)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2438)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1973)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1616)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1447)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:788)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1187)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:270)
	at connectURL.main(connectURL.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
	at java.lang.Thread.run(Thread.java:745)

I am using macOS 10.12.3, JDK 8 Update 121. Same example from Windows is working fine and I can connect with no problems.

I also tried a connection string different with the following format

jdbc:sqlserver://server.database.windows.net;databaseName=database-name;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;

I also tried the parameters in different combinations
-Djsse.enableCBCProtection=false
-Djdk.tls.client.protocols=TLSv1

Attached you can find the output when debugging SSL as suggested in a couple of places, but I could not figure out the root of the problem

output.txt

If I try to connect to a SQL Server deployed in the RDS service of AWS everything works as expected

Any help will be appreciated

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions