Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tomcat + MS SQL Server JDBC

2 views
Skip to first unread message

Kevin Spett

unread,
Oct 25, 2002, 11:17:20 PM10/25/02
to
I've been trying to get the MS JDBC for SQL Server driver working in
Tomcat, and haven't had much luck. If anyone can help out, it'd be
greatly appreciated. Here's my setup.

Win2k + SP3
Apache Tomcat/4.1.12
J2SE SDK 1.4.0.02
MS JDBC Drivers for SQL Server 2000

I've got the three .JAR files in the C:\ drive... here's the CLASSPATH
line from catalina.bat:

rem Add on extra jar files to CLASSPATH
if "%JSSE_HOME%" == "" goto noJsse
set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar;c:\mssqlserver.jar;c:\msbase.jar;c:\msutil.jar
:noJsse
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar;c:\mssqlserver.jar;c:\msbase.jar;c:\msutil.jar

And here's a .jsp file that I try to execute.. this is it, all it does
is try a connection.

<%@page language="java" import="java.sql.*"%>

<%
String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
Class.forName(driver);

Connection con = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://TWOKSERVER:1433;databasename=Northwind;user=sa;password=;");
%>

And here's the error message I get when trying to access it:

type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

org.apache.jasper.JasperException:
com.microsoft.jdbc.sqlserver.SQLServerDriver
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

..... more jvm trace stuff....

root cause

javax.servlet.ServletException:
com.microsoft.jdbc.sqlserver.SQLServerDriver
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:497)
at org.apache.jsp.golden_jsp._jspService(golden_jsp.java:53)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

..... more jvm trace stuff....


Did I miss something in the set up, or is my code bad, or what? Any
advice, ideas, examples, etc. would be appreciated.


Thanks,
Kevin.

Murray

unread,
Oct 26, 2002, 2:22:05 AM10/26/02
to

"Kevin Spett" <ksp...@spidynamics.com> wrote in message
news:8725aeb0.02102...@posting.google.com...

I can't see anything obviously wrong in your code, and your classpath seems
to be working properly by the looks of the errors being given. Could you pls
include the entire jvm error output? I suspect it may be something to do
with your SQL server permissions seeing as all you're doing is trying to
connect.


Ed Yu

unread,
Oct 26, 2002, 12:51:04 PM10/26/02
to
You have to put the 3 jar files into CATALINA_HOME/common/lib, setting
CLASSPATH does not work unless you change the startup.bat and put it there.

"Kevin Spett" <ksp...@spidynamics.com> wrote in message
news:8725aeb0.02102...@posting.google.com...

Murray

unread,
Oct 26, 2002, 1:18:30 PM10/26/02
to

"Ed Yu" <ek...@sc.rr.com> wrote in message
news:YJzu9.15522$hp5.1...@twister.southeast.rr.com...

> You have to put the 3 jar files into CATALINA_HOME/common/lib, setting
> CLASSPATH does not work unless you change the startup.bat and put it
there.

He said that the CLASSPATH was in his Catalina.bat file which is OK. It
looks like his code it compiling fine and finding the driver at runtime.
Otherwise it would give a "Class not found" error. But without seeing the
entire error output, i could be wrong :)


Kevin Spett

unread,
Oct 27, 2002, 6:41:05 PM10/27/02
to
That's the entire error message... really... It's the generic Tomcat
500 page with that text. There's no error message from the JDBC
driver or anyting. I don't suppose you're interesting in seeing more
of the JVM trace?

Any ideas?

0 new messages