mardi 9 juin 2015

Error connecting to SQL Server 2005 in Java: Error reading prelogin response

I'm trying to connect with a SQL Server 2005 using Java but I'm getting an Exception that I don't know how to solve. I treid to googled it but I can't find exactly the same problem that is happening to me.

This is the code I'm using:

String url = "jdbc:sqlserver://IP:80"+";databaseName=intranetBD";
try {
        Connection con = DriverManager.getConnection(url, "sa", "pass");
        System.out.println("Conectado correctamente!");
        con.close();
} catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
}

And the exception that I'm getting:

Advertencia: ConnectionID:1 ClientConnectionId: ced601b1-e1be-4057-924e-cc701abcc52b Prelogin error: host [IP] port 80 Error reading prelogin response: Connection reset ClientConnectionId:ced601b1-e1be-4057-924e-cc701abcc52b
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset ClientConnectionId:ced601b1-e1be-4057-924e-cc701abcc52b
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1654)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1789)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:1424)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1319)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at org.sts.recursosComunes.Pruebas.PruebasNeus.pruebaConexionSQLServer(Pruebas.java:85)
at org.sts.recursosComunes.Pruebas.PruebasNeus.main(Pruebas.java:65)

Any idea why is it happening and how to solve it?

Thank you!

Aucun commentaire:

Enregistrer un commentaire