Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 78443 invoked from network); 14 Jun 2005 16:25:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Jun 2005 16:25:24 -0000 Received: (qmail 90386 invoked by uid 500); 14 Jun 2005 16:25:18 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 90370 invoked by uid 500); 14 Jun 2005 16:25:17 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 90331 invoked by uid 99); 14 Jun 2005 16:25:16 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of ross_s_larner@homedepot.com designates 207.11.29.246 as permitted sender) Received: from bridgit.homedepot.com (HELO homedepot.com) (207.11.29.246) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 14 Jun 2005 09:25:11 -0700 Received: from ([207.11.29.33]) by bridgit.homedepot.com with SMTP id KP-NTF20.8135928; Tue, 14 Jun 2005 12:24:14 -0400 Received: from CPWITA86.amer.homedepot.com ([165.130.218.135]) by CPWITA13.amer.homedepot.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 14 Jun 2005 12:24:14 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [DBCP] mysql authentication Date: Tue, 14 Jun 2005 12:24:13 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [DBCP] mysql authentication Thread-Index: AcVwP2T166eZqV0dRpuqs9nGigWSvAAvayog From: "Larner, Ross S" To: "Jakarta Commons Users List" X-OriginalArrivalTime: 14 Jun 2005 16:24:14.0597 (UTC) FILETIME=[8129E350:01C570FD] X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hey Tom, Forewarning - I have little knowledge of DBCP, so this may be breaking the paradigm. I don't know if you have access to the jdbc drivers for mysql, but if so, you should be able to pass the password into the call to retrieve the connection: Connection con =3D DriverManager.getConnection( url,"root", "password");=20 Take a look at this article: http://www.developer.com/java/data/article.php/3417381 Ross -----Original Message----- From: Tom Mathews [mailto:tom-mathews@supanet.com]=20 Sent: Monday, June 13, 2005 10:42 AM To: Jakarta Commons Users List Subject: Re: [DBCP] mysql authentication -p certainly works on the command line, but do you have any hints as to how to insert this programatically in a connection pool? My code looks (alot!) like this (please note there may be typo's - the machine I'm typing this from is isolated from my dev environment so I can't just copy paste!) ... try { String jdbcname =3D "jdbc/myApp"; String cmd =3D "SELECT * FROM client WHERE clientRef > 0"; Context ctx = =3D new InitialContext(); Context envCtx =3D (Context)ctx.lookup("java:comp/env"); DataSource ds =3D (DataSource)envCtx.lookup(jdbcname); Connection conn =3D ds.getConnection(); Statement stmt =3D conn.createStatement; ResultSet rs =3D stmt.executeQuery(cmd); ResultSetMetaData rsmd =3D rs.getMetaData(); .... Thanks Tom Larner, Ross S wrote: >Tom, >If I remember correctly, the -p switch is used to supply the password. > >Ross > >-----Original Message----- >From: Tom Mathews [mailto:tom-mathews@supanet.com] >Sent: Monday, June 13, 2005 4:05 AM >To: jakarta commons >Subject: [DBCP] mysql authentication > >I'm trying to set up a connection pool to a mysql 5 db using JSP on=20 >Tomcat 5, versions as follows: > >mysql-connector-java-3.1.8 >jakarta-tomcat-5.0.28 >Mysql-devel-5.0.3 >Mandrake 10.1 on AMD64 > > > >I've a resource set up which includes username and password elements#=20 >... > > > username > myUser > > > password > myPassword > >... >but whenever I try and run the pages that use this, I get an error back >saying 'Cannot create PoolableConnectionFactory (Access denied for user >'myUser'@'me.mydomain.com' (using password: NO) ' > >If I create a new database user with no password, then I can connect=20 >fine, but this is obviously not something that I want to do! > >Does anyone know how to make tomcat / mysql/J use a password (JSP=20 >rather than a stand alone java class, which is working absolutely fine). > >Thanks >Tom > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > =20 > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org