Muhammad Khalid Sohail Khan wrote:
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Do some searching in the archives. Myself and others have talked about this to people at different times. Try running tomcat not as a service, but as a standalone application and you'll find that it will work for you, so it deals with a security setting some where on your computer. I assume this is on a 2000/XP machine. You may have to give access to some registry entries to the user the service is running as for this to work properly. Anyways, it's a security issue in one way or another or it's a path related issue (the user the service is running as doesn't have all the paths needed for some native libs or something). Try adding the user the service is running as to all the directories under tomcat recursively, possibly some registry entries, and possibly some dll's for the access database drivers.


Wade


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to