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 * ****************************************************************************/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]