Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 90104 invoked from network); 21 Jan 2006 20:41:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jan 2006 20:41:23 -0000 Received: (qmail 49717 invoked by uid 500); 21 Jan 2006 20:41:22 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 49366 invoked by uid 500); 21 Jan 2006 20:41:21 -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 Delivered-To: moderator for derby-user@db.apache.org Received: (qmail 31135 invoked by uid 99); 21 Jan 2006 20:21:34 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of dfitzgeraldca@sympatico.ca designates 206.47.199.166 as permitted sender) Message-ID: <43D297B9.8050307@sympatico.ca> Date: Sat, 21 Jan 2006 15:21:13 -0500 From: Daniel Fitzgerald User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: derby-user@db.apache.org Subject: Can't find derby embedded driver when calling class is in a jar file Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi people, I have a class which does the usual : i.e. ... String dbc="org.apache.derby.jdbc.EmbeddedDriver"; String url="jdbc:derby:C:\\PersistenceStore;create=true"; ... <> ... private Connection openConnection() { Connection c = null; try { Class.forName(db_pr.getProperty("dbc")).newInstance(); c = DriverManager.getConnection(db_pr.getProperty("url"), db_pr.getProperty("uid"), db_pr.getProperty("pwd")); } catch (IllegalAccessException iae) { logException(iae, getClass().getName(), 6000); } catch (ClassNotFoundException cnfe) { logException(cnfe, getClass().getName(), 6005); } catch (InstantiationException ie) { logException(ie, getClass().getName(), 6010); } catch (SQLException se) { while (se != null) { logException(se, getClass().getName(), 6015); se = se.getNextException(); } } return c; } ... I have the derby jar files set in the classpath. This code has always worked fine from any programs run from the command line but when I package the code above into a jar file, it can't find the embedded driver for Derby anymore, although the code works fine with Oracle DB 7.x, Sybase etc. I tried to set the jar files as run-time parameters as : java -cp .;./derby.jar program.jar or java -cp %classpath% program.jar to no avail. Can anyome tell me what I have to do to get this to work ? Regards, Dan