Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with JDBC Connection

Status
Not open for further replies.

britobr

Technical User
Dec 17, 2004
3
BR
Hi,
I have a problem when connecting to a MS Access database. I'm trying to use Tomcat 5.0.28. The connection is ok when I run the class in command line, but when I try to open it in a jsp page it fails.
It works fine in Tomcat 4.
Can anyone help me!? Thanks in advance!

Brito
---------
The returned error is:

java.sql.SQLException: General error
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
java.sql.DriverManager.getConnection(DriverManager.java:512)
java.sql.DriverManager.getConnection(DriverManager.java:171)
br.ufrj.cos.modmanager.Conexao.obtemConexao(Conexao.java:25)
br.ufrj.cos.modmanager.consultas.ParametrosConsulta.<init>(ParametrosConsulta.java:23)
org.apache.jsp.modmanager.interface_.cadastraModelo_jsp._jspService(cadastraModelo_jsp.java:94)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
I forgot to mention that the error occurs exactly after the bold line below:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("JDBC:ODBC:ModManager", "", "");

Thanks in advance!
 
Hi,
Are you picking up a value for the connection from web.xml? This line in your error stood out to me:

br.ufrj.cos.modmanager.consultas.ParametrosConsulta.<init>(ParametrosConsulta.java:23)

JW

 
Thank you very much!

The problem was the Tomcat 5.0. I installed Tomcat 4.1 and it works fine now...

Brito
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top