Connection Problem with Java JDBC
The SQL server was installed in the PC and the JDBC driver jar file was installed also. But when I try to connect to the database, an error is encountered. The error message:
"com.microsoft.sqlserver.jdbc.SQLServerExcepti on: The TCP/IP connection to the host failed".
The 2 basic line of codes:
class.forname("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
Connection con = DriverManager.getConnection( "jdbc:sqlserver://localhost;user=username;passwrod=password);
(as suggested by Microsoft docmention named 'Using the JDBC Driver". Please know also the database name added to the Connection statement still does not make any different neither the port 1433.) Also the things suggested in the Microsoft document had been tried but still failed.
I am able to ping localhost (or ping 127.0.0.1) and TCP/IP is enable within the server, etc. Even setup exception port 1433 on firewall! Just don't know what else I can check or something I forget to setup?
An interesting item is when I use ODBC (configurated as ODBC) with the same Server/datbase, etc., it works perfectly. The other condition is the PC is running XP Pro and eveything is in the same computer.
Please help and thanks in advance for your help.
Best,
Don't Know Much
|