tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Muhammad Khalid Sohail Khan" <khalid.k...@uni-duisburg.de>
Subject Connecting to MS Access DB
Date Sun, 01 Aug 2004 14:11:07 GMT
Hi everybody,
I am a student and new to tomcat. I want to use simple database under MS
Access.
I have written a simple servlet, which just insert some data into table. But
I am getting following exception
"org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory ([Microsoft][ODBC Driver Manager] Data source name
not found and no default driver specified) "
(just console, main[]) and the connection is successful. I use the exact
same DriverManager Connection strings but it fails when going thru the
Servlet engine in Tomcat.
 Could somebody help me, I am struggling for last many days..
Thanks in advance.
following is the code which I am using to get connection
InitialContext initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/Address");
con = ds.getConnection();
Here is my configuration
Server.xml
<DefaultContext>
<Resource name="jdbc/Address" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/Address">
<parameter>
<name>driverClassName</name>
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:odbc:Address</value>
</parameter>
<parameter>
<name>username</name>
<value>student</value>
</parameter>
<parameter>
<name>password</name>
<value>student</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30000</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>100</value>
</parameter>
</ResourceParams>
</DefaultContext>
and
web.xml
<resource-ref>
<res-ref-name>jdbc/Address</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>



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


Mime
View raw message