Hello Ppls,
I am getting this error while connecting from a web application running in Tomcat in linux.
one particular test i did was to check for the socket
connection and as well as check for the database connection, in this case
i could open the socket but could not open the database connection :
here is the code :
<%
out.println("Checking For Sockets listening on For IP *.*.*.* port
*");
try {
Socket socket = new Socket("*.*.*.*",*);
out.println(" yes Success : " + socket);
socket.close();
}
catch(Exception e) {
out.println(e.getMessage());
}
%>
<%
out.println("Testing Connection :");
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection connection =
DriverManager.getConnection("jdbc:microsoft:sqlserver://*.*.*.*:*;DatabaseName=databasename","username","password");
out.println("Connection Successful" + connection);
connection.close();
}
catch(Exception e) {
out.println("Exception Raised"+e);
out.println(e.getMessage());
}
%>
JSP Output :
Checking For Sockets listening on For IP *.*.*.* port * yes Success :
Socket[addr=/*.*.*.*,port=*,localport=36812]
Testing Connection : Exception Raisedjava.sql.SQLException:
[Microsoft][SQLServer JDBC Driver]Error establishing socket.
[Microsoft][SQLServer JDBC Driver]Error establishing socket.
Any Solutions,Thanks in advance,
Regards,
Prashant