Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC66A8FF0 for ; Mon, 8 Aug 2011 18:55:36 +0000 (UTC) Received: (qmail 82124 invoked by uid 500); 8 Aug 2011 18:55:36 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 82031 invoked by uid 500); 8 Aug 2011 18:55:35 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 82024 invoked by uid 99); 8 Aug 2011 18:55:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 18:55:35 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of raykroeker@gmail.com designates 209.85.160.172 as permitted sender) Received: from [209.85.160.172] (HELO mail-gy0-f172.google.com) (209.85.160.172) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 18:55:30 +0000 Received: by gyf3 with SMTP id 3so1102235gyf.31 for ; Mon, 08 Aug 2011 11:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=oVIoNlhz5XGa7BtcGE49C0cmQFrkEgPW78rpXhB7Qo0=; b=AHPBXtAJsT/PDfvztaDF8fvkBmJHGZoAG+1U/XCrGPc+oqxkYkBl7tPrHew6F3YiWs QuKnwgYt6J8g/bSDDVAB6P9+Vex1TpMbdWCAmIWbMoemH7FWpGhVTPgf8xYXWggNwUo8 nZ9jrPAYHRsg8PThLLPPEr6ikRC7UZ9XILlI8= MIME-Version: 1.0 Received: by 10.142.136.8 with SMTP id j8mr6082803wfd.49.1312829709626; Mon, 08 Aug 2011 11:55:09 -0700 (PDT) Received: by 10.68.58.138 with HTTP; Mon, 8 Aug 2011 11:55:09 -0700 (PDT) Reply-To: raykroeker@gmail.com In-Reply-To: <1187248881.385094.1312829228336.JavaMail.root@sz0138a.westchester.pa.mail.comcast.net> References: <1187248881.385094.1312829228336.JavaMail.root@sz0138a.westchester.pa.mail.comcast.net> Date: Mon, 8 Aug 2011 11:55:09 -0700 Message-ID: Subject: Re: Can't Load Embedded Driver From: Raymond Kroeker To: Roy.Minet@comcast.net Cc: Derby Discussion Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Roy, The fqcn, is the fully qualified class name of the driver. So in your code you're using the driver manager to grab a connection; however I don't see a reference to loading the driver: http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html#embedded_dri= ver Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); Raymond On Mon, Aug 8, 2011 at 11:47, wrote: > I do not know what an "fqcn" is.=A0 I am running the latest Derby release= , > 10.8.1.2.=A0 The code pasted in below=A0works great=A0in the dev environm= ent > (IntelliJ Idea), but the same code packaged in a jar cannot find the driv= er > with CLASSPATH set correctly. > > =A0=A0 public static Connection getConnection() > =A0=A0 { > =A0=A0=A0=A0=A0 Connection c =3D null; > =A0=A0=A0=A0=A0 try > =A0=A0=A0=A0=A0 {=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // The connectionUR= L > is=A0"jdbc:derby:EMDatabase;create=3Dtrue" > =A0=A0=A0=A0=A0=A0=A0=A0 c =3D DriverManager.getConnection(connectionURL)= ; > =A0=A0=A0=A0=A0=A0=A0=A0 c.setAutoCommit(false); > =A0=A0=A0=A0=A0 } > =A0=A0=A0=A0=A0 catch (Throwable e) > =A0=A0=A0=A0=A0 { > =A0=A0=A0=A0=A0=A0=A0=A0 log(3, "Unable to connect to " + dbName + ":=A0 = " + e.getMessage()); > =A0=A0=A0=A0=A0=A0=A0=A0 stopDBMS(); > =A0=A0=A0=A0=A0=A0=A0=A0 System.exit(3); > =A0=A0=A0=A0=A0 } > =A0=A0=A0=A0=A0 return c; > =A0=A0 } > > > > ________________________________ > > From: "Raymond Kroeker" > > To: "Derby Discussion" > Sent: Monday, August 8, 2011 10:08:11 AM > Subject: Re: Can't Load Embedded Driver > > Can you try specifying the driver as a fqcn? If that doesn't solve the is= sue > please paste relevant code around how you load the driver and obtain a > connection. > > Raymond > > On Aug 8, 2011 6:55 AM, wrote: >> >> >> Rick, >> >> >> >> Thank you very much for offering your help.=A0 Apparently my CLASSPATH i= s >> good.=A0 I=A0typed in=A0"java org.apache.derby.jdbc.EmbeddedDriver" and = did indeed >> get exactly the expected "Exception in thread "main" >> java.lang.NoSuchMethodError: main" error message.=A0 What else=A0could b= e >> causing =A0my problem? >> >> >> >> Roy >> >> >> >> >> >> ----- Original Message ----- >> >> >> From: "Rick Hillegas" >> To: "Derby Discussion" >> Sent: Monday, August 8, 2011 9:00:58 AM >> Subject: Re: Can't Load Embedded Driver >> >> On 8/7/11 9:54 AM, Roy.Minet@comcast.net wrote: >>> >>> I have been happily using Derby for two years within IntelliJ Idea, >>> but have now hit a wall trying to deploy the application I developed. >>> I have tried setting the path to derby.jar on the command line and/or >>> in the CLASSPATH environment variable to no avail. =A0The embedded >>> driver doesn't load; the error message is, "No suitable driver found >>> for jdbc:derby:EMDatabase;create=3Dtrue". =A0I'm under Windows XP Pro. >>> Any help would be appreciated. >>> >>> Roy Minet >>> >>> >> Hi Roy, >> >> This is almost always a CLASSPATH problem. With the same CLASSPATH, try >> the following experiment: >> >> java org.apache.derby.jdbc.EmbeddedDriver >> >> If the CLASSPATH is good, you should see this error: >> >> Exception in thread "main" java.lang.NoSuchMethodError: main >> >> Hope this helps, >> -Rick > --=20 --------------------------------------------------------- Raymond Kroeker