tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aris Javier" <aristotle.jav...@eazix.com>
Subject RE: Connecting to MS Access DB
Date Mon, 02 Aug 2004 01:01:24 GMT

Did you make your DSN as "System DSN" ?
Don't make your DSN inside "User DSN" when running
Tomcat as a service...

I've been using Tomcat and Access under win2k... and don't
have problems...

-----Original Message-----
From: Wade Chandler [mailto:wchandler@redesetgrow.com] 
Sent: Monday, August 02, 2004 3:18 AM
To: Tomcat Users List
Subject: Re: Connecting to MS Access DB


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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 

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: 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


Mime
View raw message