axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjesh Pathak" <sanj...@soapknox.com>
Subject RE: Tomcat + Axis2 + MySQL
Date Wed, 20 Sep 2006 14:31:31 GMT
 
Looks ok to me.
 
Sanjesh
Real-Time Web Service Monitoring for Axis, Axis2
SoapKnox Inc
http://www.soapknox.com
Ph: 832 279 3745
 
 
  _____  

From: Prótár Gábor [mailto:protar.gabor@gmail.com] 
Sent: Wednesday, September 20, 2006 7:41 AM
To: axis-user@ws.apache.org
Subject: Tomcat + Axis2 + MySQL
 
Hello!
 
I wrote a similar mail yesterday, but now I found something.
 
I am using Tomcat v5.5.17, Axis 2 v1.0, MySQL v5.0.24, MySQL Connector/J
v5.0.3
 
This is how I configured MySQL under Tomcat:
 
1.: put context information to server.xml: <tomcat install
folder>/conf/server.xml
 
<Context path="/axis2" docBase="axis2"
        debug="5" reloadable="true" crossContext="true">
 
  <Resource name="jdbc/TestDB2" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="100000"
               username="wsuser" password="pass"
driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/ws?autoReconnect=true"/>
</Context>
 
2.: create resource link to the web.xml file at <tomcat install
folder>/webapps/axis2/web-inf/web.xml
 
   <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
 
This resource works well in a test servlet, but I don’t how to use it axis2
webservice.
 
My question is: how can I reference this resource from java code?
 
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB");
Connection conn = ds.getConnection();
 
Is it correct?
 
Thanks,
Gábor
 
 

Mime
View raw message