You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ilasno <il...@netscape.net> on 2004/06/08 03:54:41 UTC

problems connecting to networked odbc data source

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

Re: problems connecting to networked odbc data source

Posted by Parsons Technical Services <pa...@earthlink.net>.
See this message for a link to a jdbc driver.

http://marc.theaimsgroup.com/?l=tomcat-user&m=108354562017331&w=2


----- Original Message ----- 
From: "David Smith" <dn...@cornell.edu>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, June 07, 2004 10:19 PM
Subject: Re: problems connecting to networked odbc data source


> Check the archives -- jdbc-odbc bridge is a bad idea.  It's never been
> stable to my knowlege.  I'd recommend either a real MS SQL server or
> some other database server with a good JDBC driver.
>
> --David
>
> ilasno wrote:
>
> > 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:3
11)
> >
> >    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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: problems connecting to networked odbc data source

Posted by David Smith <dn...@cornell.edu>.
Check the archives -- jdbc-odbc bridge is a bad idea.  It's never been 
stable to my knowlege.  I'd recommend either a real MS SQL server or 
some other database server with a good JDBC driver.

--David

ilasno wrote:

> 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



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org