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

:-)


> -----Original Message-----
> From: Marc Logemann [mailto:[EMAIL PROTECTED]]
> Sent: 02 July 2002 13:35
> To: [EMAIL PROTECTED]
> Subject: plain MySQL DataSource in Tomcat (i know, damn topic)
> 
> 
> Hi,
> 
> i am one of the guys trying to get a valid MysqlDataSource 
> reference via
> JNDI. But i am getting crazy without knowing where the 
> problem is (perhaps
> the reason is, i cant debug JNDI too good, cause i am no 
> expert in it..)
> 
> i have the following:
> 
> server.xml
> ----------
> <context ....>
> <Resource name="jdbc/TestDB" auth="Cotainer" 
> type="javax.sql.DataSource"/>
> <ResourceParams name="jdbc/TestDB">
>     <parameter>
>         <name>factory</name>
>         
> <value>org.gjt.mm.mysql.jdbc2.optional.MysqlDataSourceFactory</value>
>       </parameter>
> <parameter> <name>user</name><value>root</value> </parameter>
> <parameter> <name>password</name><value></value> </parameter>
> <parameter> 
> <name>driverClassName</name><value>org.gjt.mm.mysql.jdbc2.opti
> onal.MysqlDataSource</value></parameter>
> <parameter> 
> <name>driverName</name><value>jdbc:mysql://localhost/maxbahr</
> value> </parameter>
> </ResourceParams>
> </context>
> 
> web.xml
> -------
> <web-app>
> <resource-ref>
>   <description>DataSource MySQL</description>
>   <res-ref-name>jdbc/TestDB</res-ref-name>
>   <res-type> javax.sql.DataSource</res-type>
>   <res-auth>Container</res-auth>
> </resource-ref>
> </web-app>
> 
> i placed the mysql mm jar into commons/lib
> 
> When i run a servlet with the standard lookup code:
>      try {
>          javax.naming.Context jndictx = new InitialContext();
>          if (jndictx == null) throw new Exception("Boom - No 
> Context");
> 
>          DataSource ds =
>                  (DataSource) 
> jndictx.lookup("java:comp/env/jdbc/TestDB");
>          if (ds != null) {
> [..]
> 
> i get no exception but i also dont get any reference returned 
> from lookup.
> 
> I read tons of websites including the tomcat JNDI howto, 
> without beeing able to understand it
> better (in fact it gets worse cause of thousands of 
> combinations in the web for server.xml and
> web.xml)
> 
> When i leave out factory in the server.xml, i get a tyrex 
> exception regarding loading a factory...
> 
> I just thought that using a datasource is better than just 
> calling the DriverManager, but the
> effort seems amazing... or i am too unclever... whatever...
> 
> thx for help.
> ---
> greetings from
> Marc Logemann
> Homebase @ www.logemann.info
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

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

Reply via email to