Hi all,
I've spent 7 hours straight trying to connect to my local MS SQL Server Express through JDBC, and didnt get it
here's my code
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
SQLServerDataSource ds = new SQLServerDataSource();
ds.setUser("sa");
ds.setPassword("ph4r400h");
ds.setServerName("localhost");
ds.setDatabaseName("PDV");
ds.setPortNumber(1433);
ds.setServerName("ANDRE-9580A17BA\\SQLEXPRESS");
ds.setIntegratedSecurity(true);
Connection con = ds.getConnection();
I tried to switch these settings.. but nothing changed.. I made some server configurations tough but still didnt work.
I did imported correctly the JDBC driver.
The error message sometimes is "The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect", but if I comment the ds.setPort method the error turns to "The connection to the named instance has failed. Error: java.net.SocketTimeoutException: Receive timed out."
If you know some good tutorial about this kind of connection, please send to me...
Any help is welcome!
thanks so much