tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilasno <ila...@netscape.net>
Subject problems connecting to networked odbc data source
Date Tue, 08 Jun 2004 01:54:41 GMT
hello,

here's my setup.  i have a development linux server running debian, 
tomcat 5.0.16, and java 1.3. i have successfully connected to a remote 
mysql database (on port 3306 with a connection string like 
'jdbc:mysql://xx.xx.xx.xx:3306/dbName?autoReconnect=true') with a 
datasource configured in the server.xml file.

the computer i work on is running windows 2000 server and is networked 
with the debian linux box, and what i would like to do is configure a 
datasource within the debian tomcat server.xml that would connect with a 
microsoft access database that is set up as a DSN on the windows 
server.  i started with a datasource configuration like this:

<<Resource name="jdbc/dbName" auth="Container" 
type="javax.sql.DataSource" />
- <#> <ResourceParams name="jdbc/ilDb">
- <#>   <parameter>
      <name>factory</name>
  <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
 </parameter>
- <#>   <parameter>
  <name>driverClassName</name>
  <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
     </parameter>
 <parameter>
   <name>url</name>
  <value>jdbc:odbc://192.168.0.2/dbName?autoReconnect=true</value>
    </parameter>

...other parameters, including maxActive, username, password, etc...
- <#> 
  </ResourceParams>

but i was getting a null reference when i tried to create the connection 
object from the datasource object.  so, to try to get something going, i 
then moved to an all-code connection, like so:

String url= "jdbc:odbc://192.168.0.2/dbName";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
conn = DriverManager.getConnection(url);

but it's still throwing an exception on the line that attempts to get a 
connection, this time like so:

java.lang.Exception: DB:getTest() failed: No suitable driver
    at net.ilasno.db.DB.getTest(DB.java:82)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:45)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


it's my understanding that the jdbc/odbc bridge driver is a part of the 
core java classes.  at this point i would settle for either technique, i 
just want to access the data!  any suggestions?

thanks for your time
-- 
ilasno

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message