Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 90241 invoked from network); 8 Dec 2007 04:19:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Dec 2007 04:19:49 -0000 Received: (qmail 21506 invoked by uid 500); 8 Dec 2007 04:19:37 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 21420 invoked by uid 500); 8 Dec 2007 04:19:37 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 21406 invoked by uid 99); 8 Dec 2007 04:19:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2007 20:19:37 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of flamefew@gmail.com designates 209.85.134.187 as permitted sender) Received: from [209.85.134.187] (HELO mu-out-0910.google.com) (209.85.134.187) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Dec 2007 04:19:16 +0000 Received: by mu-out-0910.google.com with SMTP id i2so1518747mue for ; Fri, 07 Dec 2007 20:19:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=yv9+67YrGkuIHHFQxMtyqQcXiyv4e2EE7mtxFCKS3LQ=; b=DuliY1PqBdBlnIyfqSAg2PYxOznIqS084kCZa0DRyFBYeISZ8hCGQ3s8l/kQT3MN3QvLlSq3do3xmvXeB75G+11l1MUiN32YtSdxWDKTpIszeY/ia6cnFtlJd3FQUhOIqgX+PIUIQrL7eMIoNf+qj1r+sVEZhTvRM8DPlvtL+KQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VbQHw+5+g6kL2WKvlGhwbnOtOXk7STzDtLZHznURUVApdJjNIHFrQ3zRaym7j3XM+CPZVBTrSGX7jYTlYT7r/R5v3mfLaEJogNlnmAcglephYbBBWjn7J1XR/TV2V3pKcQra4A0dpO4HLrjp3uQlSZx76/Dp9XHxalw2NjucjeA= Received: by 10.82.181.7 with SMTP id d7mr202023buf.1197087557357; Fri, 07 Dec 2007 20:19:17 -0800 (PST) Received: by 10.82.171.4 with HTTP; Fri, 7 Dec 2007 20:19:17 -0800 (PST) Message-ID: <31cc37360712072019l165286f4wc7600e26043b016a@mail.gmail.com> Date: Fri, 7 Dec 2007 20:19:17 -0800 From: "Henri Yandell" To: "Jakarta Commons Developers List" Subject: Re: Tomcat DBCP with Oracle JDBC OCI 10g driver In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org When you say it crashes the JVM; how is it crashing it? Hen On Dec 7, 2007 12:37 PM, wrote: > To Whom It May Concern, > > Does anyone have a checklist for implementing Oracle JDBC OCI 10g driver > in the Tomcat server DBCP connection pool. It seems very simple > according to directions from Oracle but I must be missing one piece. > I have confirmed the external setup with tnsnames.ora and the oracle > client installation. I can connect with SQL Navigator and with a simple > java program that uses the oci driver but does not use the connection > pool. When I try to use this same driver and the connection pool it > crashes the JVM. > > 1. install oracle client -- done and verified > 2. verify ORACLE_HOME/bin is in the PATH -- done and verified > 3. set TNS_NAMES correctly -- done and verified > 4. use the Oracle 10g driver ( ojdbc14.jar ver. 10.2.0.3 ) -- done, > downloaded and verified with thin client > 5. configure the connection pool ( see below ) -- I think this is > correct, work with thin, not with oci > > 1. correct driver, type, and factory ( from examples ) > > The simple program uses the OracleDataSource to get the connection. > What does the DBCP do different than my simple program to get a physical > connection to the database? > > Any suggestions are greatly appreciated. > > Jeff > > > TNS_ADMAIN: is set to the directory with tnsnames.ora lives > > TNSNAMES.ORA: > > MYDB = > (DESCRIPTION = > (ADDRESS_LIST = > (ADDRESS = (PROTOCOL = TCP)(HOST = 10.62.37.78)(PORT = 1521)) > ) > (CONNECT_DATA = > (SERVICE_NAME = SAMPF) > ) > ) > > THIS WORKS: > > auth="Container" > type="oracle.jdbc.pool.OracleDataSource" > driverClassName="oracle.jdbc.driver.OracleDriver" > factory="oracle.jdbc.pool.OracleDataSourceFactory" > url="jdbc:oracle:thin:@MYDB" > user="scott" > password="tiger" > maxActive="20" > maxIdle="10" > maxWait="-1" /> > > THIS CRASHES THE JVM: > > auth="Container" > type="oracle.jdbc.pool.OracleDataSource" > driverClassName="oracle.jdbc.driver.OracleDriver" > factory="oracle.jdbc.pool.OracleDataSourceFactory" > url="jdbc:oracle:oci:@MYDB" > user="scott" > password="tiger" > maxActive="20" > maxIdle="10" > maxWait="-1" /> > > Simple Java Program > > package com.cox.pap.paws.test; > > /* > * This sample can be used to check the JDBC installation. > * Just run it and provide the connect information. It will select > * "Hello World" from the database. > */ > > // You need to import the java.sql and JDBC packages to use JDBC > import java.io.IOException; > import java.sql.Connection; > import java.sql.ResultSet; > import java.sql.SQLException; > import java.sql.Statement; > > import oracle.jdbc.pool.OracleDataSource; > > public class DBConnectionTest > { > public static void main(String args[]) > throws SQLException, IOException > { > > // Prompt the user for connect information > String user = "scott"; > String password = "tiger"; > String database = "MYDB"; > String url = "jdbc:oracle:oci:@" + database; > String sql = "select 'Hello World' from dual"; > > System.out.println("url = " + url); > System.out.println("sql = " + sql); > System.out.flush(); > > System.out.print("Connecting..."); > // Open an OracleDataSource and get a connection > OracleDataSource ods = new OracleDataSource(); > ods.setURL(url); > ods.setUser(user); > ods.setPassword(password); > Connection conn = ods.getConnection(); > System.out.println("Connected."); > > // Create a statement > Statement stmt = conn.createStatement(); > > // Do the SQL "Hello World" thing > ResultSet rset = stmt.executeQuery(sql); > > System.out.print("Results from query >> "); > while (rset.next()) > System.out.println(rset.getString(1)); > // close the result set, the statement and connect > rset.close(); > stmt.close(); > conn.close(); > System.out.println("Your JDBC installation is correct."); > } > > } > > Output > > url = jdbc:oracle:oci:@MYDB > sql = select 'Hello World' from dual > Connecting...Connected. > Results from query >> Hello World > Your JDBC installation is correct. > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org