hi,
 i tested with the jar files as mentioned in the mail. I am getting
null datasource. i did the following:
---------------------
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase"/>
<DefaultContext>
<Resource name="testDataSource".............../>
</ResourceParams ...>
...
</ResourceParams>
<host>
...
</host>
------------------

CAN NEBODY WHO HAS USED CONNECTION POOLING WITH TOMCAT AND MYSQL
ELABORATE THE PROCEDURE END-TO-END. I SHALL BE REALLY THANKFUL.
thanks
On Thu, 23 Sep 2004 17:50:50 +0300, ALPER AYKAC
<[EMAIL PROTECTED]> wrote:
> 
> 
> hi,
> 
> I have not tested yet but some Jen (Caroline Jen <[EMAIL PROTECTED]>)
> proposed a solution. Steps are below:
> note: if you test please forward  your reply to [EMAIL PROTECTED]
> 
> Step 1.
> 
> DBCP uses the Jakarta-Commons Database Connection Pool. It relies on number
> of
> Jakarta-Commons componenets:
> 
> Jakarta-Commons DBCP 1.2.1
> Jakarta-Commons Collections 2.1.1
> Jakarta-Commons Pool 1.2
> 
> These jar files along with your the jar file for your JDBC driver should be
> installed in
> $CATALINA_HOME/common/lib.
> NOTE:Third Party drivers should be in jarfiles, not zipfiles. Tomcat only
> adds
> $CATALINA_HOME/common/lib/*.jar to the classpath.
> 
> Step 2.
> download the most up-to-date version of the classes12.zip rename it to
> classes12.jar
> http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
> and place it in TOMCAT_HOME\common\lib
> 
> Step 3.
> check the read and execute access to the classes12.jar file (by right-click
> on the file and
> 
> look for 'properties')
> 
> Step 4. C:\jakarta-tomcat-5.0.27\conf\server.xml configuration
> Note: I added the following code in between the <realm .../> element and
> the <Host> element.
> 
> <DefaultContext>
>    <Resource name="jdbc/OracleDB" auth="Container"
>              type="javax.sql.DataSource"/>
> 
>    <ResourceParams name="jdbc/OracleDB">
>       <parameter>
>          <name>factory</name>
>          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
>       <parameter>
>          <name>maxWait</name>
>          <value>-1</value>
>       </parameter>
>       <parameter>
>          <name>maxActive</name>
>          <value>20</value>
>       </parameter>
>       <parameter>
>          <name>password</name>
>          <value>your password</value>
>       </parameter>
>       <parameter>
>          <name>url</name>
>          <value>jdbc:oracle:thin:@172.19.47.22:1521:SystemID</value>
>       </parameter>
>       <parameter>
>          <name>driverClassName</name>
>          <value>oracle.jdbc.driver.OracleDriver</value>
>       </parameter>
>       <parameter>
>          <name>maxIdle</name>
>          <value>10</value>
>       </parameter>
>       <parameter>
>          <name>username</name>
>          <value>your username</value>
>       </parameter>
>       <parameter>
>          <name>removeAbandoned</name>
>          <value>true</value>
>       </parameter>
>       <parameter>
>          <name>removeAbandonedTimeout</name>
>          <value>60</value>
>       </parameter>
>       <parameter>
>          <name>logAbandoned</name>
>          <value>true</value>
>       </parameter>
> </ResourceParams>
> </DefaultContext>
> 
> Step 5. web.xml Configuration (the one in MyApp/WEB-INF directory)
> 
> add these lines after the <taglib> element
> 
> 
> Äyi ÃalÄÅmalar
> Alper AYKAÃ
> Uzman MÃh.
> Telsim Mobil TelekomÃnikasyon Hizmetleri A.Å.
> Projeler MÃdÃrlÃÄÃ
> Tel.0212 4487239  Dahili: 7239
> Cep. 05423877659  VPN: 6928
> 
> |---------+---------------------------->
> |         |           Atishay Kumar    |
> |         |           <[EMAIL PROTECTED]|
> |         |           ail.com>         |
> |         |                            |
> |         |           23.09.2004 17:43 |
> |         |           Please respond to|
> |         |           Atishay Kumar    |
> |---------+---------------------------->
>   
> >------------------------------------------------------------------------------------------------------------------------------|
>   |                                                                                  
>                                             |
>   |       To:       ALPER AYKAC <[EMAIL PROTECTED]>                                  
>                                     |
>   |       cc:       Tomcat Users List <[EMAIL PROTECTED]>                            
>                                |
>   |       Subject:  Re: jndi problem                                                 
>                                             |
>   
> >------------------------------------------------------------------------------------------------------------------------------|
> 
> 
> 
> 
> hi,
> i solved no DataSource problem. i was putting <Resource
> >..............</Resource> under a context that i had created. now i
> have it under <host> tag.
> i am getting
> --------
> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
> of class '' for connect URL 'null'
> ----------
> now i am using
> mysql-connector-java-3.0.15-ga-bin.jar
> commons-collections.jar
> commons-dbcp-1.2.1.jar
> commons-pool-1.1.jar
> commons-logging-api.jar
> ------------------
> tomcat 4.1.30
> mysql 2.23.58-9
> ----------------
> 
> Is different version of common pool and common dbcp creating any problem?
> any help welcome
> thanks
> 
> On Thu, 23 Sep 2004 14:25:51 +0300, ALPER AYKAC
> <[EMAIL PROTECTED]> wrote:
> >
> >
> > hÄ,
> >
> > so you mean there is no solution , no way to use data pooling with
> tomcat.
> > There is a strange code below, Have you ever tried the code below, code
> is
> > not clear enough..
> >
> > DatasourceFactory is a singleton class used to retrieve the datasource
> from
> > tomcat using JNDi..and connection is obtained from datasource...
> > public static DataSource getInstance() throws SystemException
> > {
> > if (!isDataSrcAvaliable)
> > {
> > if (dataSource == null)
> > {
> > new DataSourceFactory();
> > doLookUp();
> > isDataSrcAvaliable = true;
> > } //end if (dataSource == null)
> > }// end if (!isDataSrcAvaliable)
> > return dataSource;
> > } /* end getInstance() */
> >
> > doLookUp method does this:
> > Context ctx = new InitialContext();
> > String dataSrc =
> > msgResource.getMessage(OEMAPIConstants.DATA_SOURCE_NAME);
> > Context env = (Context)ctx.lookup("java:comp/env");
> > dataSource = (DataSource) env.lookup(dataSrc);
> >
> > public static Connection getConnection() throws DAOException
> > {
> > DataSource ds = (DataSource) DataSourceFactory.getInstance();
> > Connection con = ds.getConnection();
> > return ds.getConnection();
> > }
> > and every database lookup class, gets this connection and closes the
> > connection after the query to database...
> >
> > Äyi ÃalÄÅmalar
> > Alper AYKAÃ
> > Uzman MÃh.
> > Telsim Mobil TelekomÃnikasyon Hizmetleri A.Å.
> > Projeler MÃdÃrlÃÄÃ
> > Tel.0212 4487239  Dahili: 7239
> > Cep. 05423877659  VPN: 6928
> >
> > |---------+---------------------------->
> > |         |           Atishay Kumar    |
> > |         |           <[EMAIL PROTECTED]|
> > |         |           ail.com>         |
> > |         |                            |
> > |         |           23.09.2004 12:38 |
> > |         |           Please respond to|
> > |         |           Atishay Kumar    |
> > |---------+---------------------------->
> >
> >------------------------------------------------------------------------------------------------------------------------------|
> 
> >   |
> |
> >   |       To:       ALPER AYKAC <[EMAIL PROTECTED]>
> |
> >   |       cc:
> |
> >   |       Subject:  Re: jndi problem
> |
> >
> >------------------------------------------------------------------------------------------------------------------------------|
> 
> >
> >
> >
> >
> > i have  the following in commom/lib.
> > mysql-connector-java-3.0.11-stable-bin.jar
> > and i am able to connect to mysql without connection pooling. but with
> > connection pooling i am getting Null DataSource.
> > am i using the wrong jar file?? i am using tomcat 4.1.27 on linux
> > (fedora core 2) and mysql 3.23.58-9
> > thanks
> > On Thu, 23 Sep 2004 12:17:01 +0300, ALPER AYKAC
> > <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hi Atishay,
> > >
> > > I have the same problem...
> > > Any solution for this problem..
> > >
> > > Do you have MySQL JDBC Driver jar ?. Put it in common\lib and restart
> > > Tomcat
> > > to test
> > >
> > > rgds
> > > Antony Paul
> > >
> > > ----- Original Message -----
> > > From: "Atishay Kumar" <[EMAIL PROTECTED]>
> > > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, September 22, 2004 9:30 AM
> > > Subject: Re: cud not solve javax.naming.NamingException: Cannot create
> > > resource instance
> > >
> > > > i was not putting the following lines, that's why i namingException
> > > > was coming. BUT I AM NOW GETTING THE DataSource as null. Any clues??
> > > >
> > > > ----------------
> > > > <parameter>
> > > > <name>factory</name>
> > > > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> > > > </parameter>
> > > > -------------------------
> > > >
> > > >
> > > > On Tue, 21 Sep 2004 19:41:03 +0000, Atishay Kumar
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > hi,
> > > > >  i am trying to do MySql Connection Pooling in Tomcat 4.1.27. I am
> > > > > getting the following error
> > > > > ------------------
> > > > > javax.naming.NamingException: Cannot create resource instance
> > > > > ------------------
> > > > > doing some googly revealed that i need some commons-.. jar files to
> > be
> > > > > present in common/lib folder. but i already had them in common/lib
> > > > > folder. the files in lib folder are
> > > > > --------------------------
> > > > > activation.jar           commons-dbcp.jar
> jdbc2_0-stdext.jar
> > > > >                        naming-common.jar
> > > > > ant.jar                  commons-logging-api.jar  jndi.jar
> > > > >                        naming-factory.jar
> > > > > classes111.jar           commons-pool.jar         jta.jar
> > > > >                        naming-resources.jar
> > > > > classes12.jar            jasper-compiler.jar      mail.jar
> > > > >                        servlet.jar
> > > > > commons-collections.jar  jasper-runtime.jar
> > > > > mysql-connector-java-3.0.11-stable-bin.jar
> > > > > -------------------------
> > > > > my server.xml
> > > > >
> > > > > <Context path="/student" docBase="student_directory" debug="0"
> > > > > priveledge="true">
> > > > >         </Context>
> > > > >         <Context path="/testing" docBase="test" debug="0"
> > > priveledge="true">
> > > > >         <Resource name="jdbc/testDataSource" auth="Container"
> > > > > type="java.sql.DataSource"/>
> > > > >         <ResourceParams name="jdbc/testDataSource">
> > > > >         <parameter>
> > > > >               <name>user</name>
> > > > >               <value>root</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                <name>password</name>
> > > > >                <value></value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >             <name>driverClassName</name>
> > > > >             <value>com.mysql.jdbc.Driver</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >              <name>url</name>
> > > > >              <value>jdbc:mysql://localhost:3306/mysql</value>
> > > > >         </parameter>
> > > > >         </ResourceParams>
> > > > >        </Context>
> > > > > ------------------------------------
> > > > > web.xml
> > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > >
> > > > > <!DOCTYPE web-app
> > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd";>
> > > > > <web-app>
> > > > >   <display-name>This is a test folder </display-name>
> > > > >   <description>
> > > > >      Welcome to the test folder
> > > > >   </description>
> > > > > <resource-ref>
> > > > >  <description>MySql Datasource for Student Directory</description>
> > > > >  <res-ref-name>jdbc/testDataSource</res-ref-name>
> > > > >  <res-type>javax.sql.DataSource</res-type>
> > > > >  <res-auth>Container</res-auth>
> > > > > </resource-ref>
> > > > > </web-app>
> > > > > -----------------------------
> > > > > mysql_connection_test.jsp
> > > > >
> > > > > <%@ page import="java.sql.*" %>
> > > > > <%@ page import="javax.naming.*"%>
> > > > > <%@ page import="javax.sql.*"%>
> > > > > <html>
> > > > > <head>
> > > > > <title>test</title>
> > > > > </head>
> > > > > <body>
> > > > > <%
> > > > >  try
> > > > >  {
> > > > >         Context ctx= new InitialContext();
> > > > >         if(ctx==null)
> > > > >                 throw new Exception("not able to find intial
> > context");
> > > > >         DataSource
> > > > > ds=(DataSource)ctx.lookup("java:comp/env/jdbc/testDataSource");
> > > > >         if(ds!=null)
> > > > >         {
> > > > >                 Connection conn=ds.getConnection();
> > > > >                 Statement stmt=conn.createStatement();
> > > > >                 ResultSet rs=stmt.executeQuery("select
> > > current_date()");
> > > > >                 if(rs==null)
> > > > >                      out.println("No rowset returned");
> > > > >                  else
> > > > >                  {
> > > > >                      rs.next();
> > > > >                      out.println("Current Date"+rs.getString(1));
> > > > >                  }
> > > > >                  rs.close();
> > > > >                  stmt.close();
> > > > >                  conn.close();
> > > > >
> > > > >         }
> > > > >  }
> > > > > catch(Exception e)
> > > > > {
> > > > >  out.println("Error found: "+e);
> > > > > }
> > > > >
> > > > > %>
> > > > > </body>
> > > > > </html>
> > > > > -------------------------------------------
> > > > > please help me in resolving it.
> > > > >
> > > > > thanks
> > > > > --
> > > > > :)
> > > > > Atishay Kumar
> > > > > Btech, SEM VII
> > > > > DA-IICT
> > > > > Gandhinagar - 382009
> > > > > India
> > > > > ph: +91 9825383948
> > > > >
> > >
> >
> /***************************************************************************
> 
> >
> > >
> > > *
> > > > >  * Learn the rules as you would need them to break them properly *
> > > > >
> > >
> >
> ****************************************************************************
> 
> >
> > >
> > > /
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > :)
> > > > Atishay Kumar
> > > > Btech, SEM VII
> > > > DA-IICT
> > > > Gandhinagar - 382009
> > > > India
> > > > ph: +91 9825383948
> > > >
> > >
> >
> /***************************************************************************
> 
> >
> > >
> > > *
> > > >  * Learn the rules as you would need them to break them properly *
> > > >
> > >
> >
> ****************************************************************************
> 
> >
> > >
> > > /
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > >
> > > Ãyi ÃalÃÃmalar
> > > Alper AYKAÃ
> > > Uzman MÃh.
> > > Telsim Mobil TelekomÃnikasyon Hizmetleri A.Ã.
> > > Projeler MÃdÃrlÃÃÃ
> > > Tel.0212 4487239  Dahili: 7239
> > > Cep. 05423877659  VPN: 6928
> > >
> > >
> >
> > --
> > :)
> > Atishay Kumar
> > Btech, SEM VII
> > DA-IICT
> > Gandhinagar - 382009
> > India
> > ph: +91 9825383948
> >
> /****************************************************************************
> 
> >
> >  * Learn the rules as you would need them to break them properly *
> >
> >
> ****************************************************************************/
> 
> >
> >
> 
> --
> :)
> Atishay Kumar
> Btech, SEM VII
> DA-IICT
> Gandhinagar - 382009
> India
> ph: +91 9825383948
> /****************************************************************************
> 
>  * Learn the rules as you would need them to break them properly *
> 
> ****************************************************************************/
> 
> 



-- 
:)
Atishay Kumar
Btech, SEM VII
DA-IICT
Gandhinagar - 382009
India
ph: +91 9825383948
/****************************************************************************
 * Learn the rules as you would need them to break them properly *
 ****************************************************************************/

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

Reply via email to