Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 20719 invoked from network); 18 Aug 2002 11:32:07 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 18 Aug 2002 11:32:07 -0000 Received: (qmail 14604 invoked by uid 97); 18 Aug 2002 11:31:51 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 14495 invoked by uid 97); 18 Aug 2002 11:31:51 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 14414 invoked by uid 98); 18 Aug 2002 11:31:50 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <3D5F85E5.5050207@sydneybluegum.com> Date: Sun, 18 Aug 2002 21:32:53 +1000 From: Simon T User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020721 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: BasicDataSourceFactory and TC 4.1.9 References: <200208172007.OAA5536825@canuck.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Paul, I have mysql working ok with mm.mysql-2.0.11-bin.jar file in the common/lib I am using the jdk1.3.1 with the full tomcat 4.1.19 installation. Which JDK are you using? The context web.xml needs to be updated for the context in the server.xml e.g in the tomcat example they created DBTest <%@page language="java" import="javax.sql.*"%> <%@page import="javax.naming.*" %> <%@page import="java.util.*" %> <%@page import="java.sql.*" %> <% Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource)envCtx.lookup("jdbc/mysql"); Connection conn = ds.getConnection(); Statement StatementRecordset1 = conn.createStatement(); ResultSet Recordset1 = StatementRecordset1.executeQuery("select * from abc"); boolean Recordset1_isEmpty = !Recordset1.next(); boolean Recordset1_hasData = !Recordset1_isEmpty; int Recordset1_numRows = 0; int Repeat1__numRows = 100 ; int Repeat1__index = 0 ; Recordset1_numRows += Repeat1__numRows; %> <% while ((Recordset1_hasData)&&(Repeat1__numRows-- != 0)) { %> <%Repeat1__index++; Recordset1_hasData = Recordset1.next();} Recordset1.close(); conn.close(); %>
<%= (String) Recordset1.getObject("name") %>
I am having probelms getting a Connection from the DataSource I get out of >JNDI. I set up the Resource section of my server.xml as described in the >HOW-TO for 4.1.9 and am using mm.mysql 2.0.14 with MySQL 3.23.51. The DB and >dirver seem to work fine together. > >It seems I can get the DataSource from the JNDI context as expected, but >calling getConnection() yeilds an SQLException that says, "Cannot load JDBC >driver class 'null'". The driver is sitting in common/lib and can be seen and >used by servlets in my context if I do it 'by hand'. A quick look through >DBCP's BasicDataSourceFactory confirms 'driverClassName' is the correct >parameter name for the driver class, and the exception is being generated in >BasicDataSource: > > // Load the JDBC driver class > Class driverClass = null; > try { > driverClass = Class.forName(driverClassName); > } catch (Throwable t) { > String message = "Cannot load JDBC driver class '" + > driverClassName + "'"; > logWriter.println(message); > t.printStackTrace(logWriter); > throw new SQLException(message); > } > >Any help would be greatly appreciated. > > >>>From my server.xml: >type="javax.sql.DataSource"/> > > > factory > org.apache.commons.dbcp.BasicDataSourceFactory > > maxActive100 > maxIdle30000 > maxWait100 > usernametcuser > passwordXXXXX > > driverClassName > org.gjt.mm.mysql.Driver > > > url > jdbc:mysql://localhost:3306/form_rev > > > >>>From my web.xml: > > DB Connection > jdbc/form_rev_DB > javax.sql.DataSource > Container > > >-- >To unsubscribe, e-mail: >For additional commands, e-mail: > > > > -- To unsubscribe, e-mail: For additional commands, e-mail: