hi experts,
i have a problem ....
i m writing a java code to connect to the sqlserver runnign in a machine in the same domain,
i m using the sql-jdbc driver for that ....which comes as sqljdbc.jar,
the code follows:
private String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
private String databaseURL = "jdbc:sqlserver://192.168.123.345:1433;databaseName=MyPrivateDB";
private String username = "sa";
private String password = "";
Class.forName(driverName);
con = DriverManager.getConnection(databaseURL,username,password);
now the last line of the code throws an error:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect
BUT BUT
the same code runs successfully, when i use JDBC-ODBC bridge driver to connect
why so?
i have a problem ....
i m writing a java code to connect to the sqlserver runnign in a machine in the same domain,
i m using the sql-jdbc driver for that ....which comes as sqljdbc.jar,
the code follows:
private String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
private String databaseURL = "jdbc:sqlserver://192.168.123.345:1433;databaseName=MyPrivateDB";
private String username = "sa";
private String password = "";
Class.forName(driverName);
con = DriverManager.getConnection(databaseURL,username,password);
now the last line of the code throws an error:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect
BUT BUT
the same code runs successfully, when i use JDBC-ODBC bridge driver to connect
why so?