troubleshooting Question

trouble connecting with Microsoft jdbc driver

Avatar of Mark
Mark asked on
JavaJSPMicrosoft SQL Server 2005
7 Comments3 Solutions552 ViewsLast Modified:
I have a strange problem. I've set up a new tomcat installation on a new Linux Slackware computer. I am doing the following:

try {
  Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  con = DriverManager.getConnection(jdbc:sqlserver://sqlhost\\instance:1433;loginTimeout=10;user=myuser;password=mypass;");
}
catch (SQLExceltion e) { .... }

This works just fine in serveral java programs I have written on this machine, but when I use this in jsp I get an exception. e.getErrorCode() is zero; e.getMessage() is ""cantleys: cantleys: Name or service not known"

I am at a loss about this error. I have successfully installed java and tomcat on three other Linux hosts w/o this problem. "cantleys" is the hostname of this Linux computer. Why is it mentioning it as a service name? Why does this only happen with jsp but not regular java?

I am using the same tomcat version and same sqljdbc.jar on all machines. I've put the sqljdbc.jar file in .../webapps/myapp/WEB-INF/lib and in $CATALINA_HOME/lib, and it both places at once, no difference. If I remove the sqljdbc.jar file from these libs I get java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver, so I know it is using the correct jarfile.
 
This is killing me! I've been messing with it for hours and comparing with the other computers. Help! I've got a deadline!!!

THX
ASKER CERTIFIED SOLUTION
Mark

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros