You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Ro...@comcast.net on 2011/08/07 18:54:51 UTC

Can't Load Embedded Driver


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.  The embedded driver doesn't load; the error message is, "No suitable driver found for jdbc:derby:EMDatabase;create=true".  I'm under Windows XP Pro.  Any help would be appreciated. 



Roy Minet 


Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.

Duh.  That certainly looks like it would be the problem.  It had to be something pretty gross and stupid.  That will lead me to a better place on deployment.  I'll deploy a derby .jar alongside mine and reference it there instead of being dependent on some separate installation. 

Thank you all for your patience and kind attention.  Sorry to have bothered you. 



----- Original Message -----


From: "Rick Hillegas" <ri...@oracle.com> 
To: "Derby Discussion" <de...@db.apache.org> 
Sent: Tuesday, August 9, 2011 11:16:06 AM 
Subject: Re: Can't Load Embedded Driver 

On 8/9/11 7:50 AM, Bryan Pendleton wrote: 
>> C:\WINDOWS\SYSTEM32\java.exe -splash:EMsplash.jpg -jar "C:\Program 
>> Files\ElectionManager\EMServer.jar" 
> 
> Not sure if this is the problem, but I believe that if you use '-jar' on 
> your command line, then CLASSPATH is ignored, and ALL the classes have to 
> come from the jar, right? 
> 
> thanks, 
> 
> bryan 
> 
> 
That agrees with the description of "java -jar" here: 
http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html 

The jar file manifest needs to have a Class-Path attribute which lists 
the whole classpath for the application. See 
http://download.oracle.com/javase/tutorial/deployment/jar/downman.html 

Hope this helps, 
-Rick 

Re: Can't Load Embedded Driver

Posted by Rick Hillegas <ri...@oracle.com>.
On 8/9/11 7:50 AM, Bryan Pendleton wrote:
>> C:\WINDOWS\SYSTEM32\java.exe -splash:EMsplash.jpg -jar "C:\Program 
>> Files\ElectionManager\EMServer.jar"
>
> Not sure if this is the problem, but I believe that if you use '-jar' on
> your command line, then CLASSPATH is ignored, and ALL the classes have to
> come from the jar, right?
>
> thanks,
>
> bryan
>
>
That agrees with the description of "java -jar" here: 
http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html

The jar file manifest needs to have a Class-Path attribute which lists 
the whole classpath for the application. See 
http://download.oracle.com/javase/tutorial/deployment/jar/downman.html

Hope this helps,
-Rick

Re: Can't Load Embedded Driver

Posted by Bryan Pendleton <bp...@gmail.com>.
> C:\WINDOWS\SYSTEM32\java.exe -splash:EMsplash.jpg -jar "C:\Program Files\ElectionManager\EMServer.jar"

Not sure if this is the problem, but I believe that if you use '-jar' on
your command line, then CLASSPATH is ignored, and ALL the classes have to
come from the jar, right?

thanks,

bryan


Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.

C:\WINDOWS\SYSTEM32\java.exe -splash:EMsplash.jpg  -jar "C:\Program Files\ElectionManager\EMServer.jar" 



For those concerned about the path to the database, EMDatabase IS the (relative) path to the database from the working directory. 



Also, moving everything around to eliminate spaces in paths (e.g., Program Files) changes nothing (pretty much as expected, but since I'm grasping at straws, I tried it). 


----- Original Message -----


From: "Rick Hillegas" <ri...@oracle.com> 
To: "Derby Discussion" <de...@db.apache.org> 
Sent: Tuesday, August 9, 2011 9:36:02 AM 
Subject: Re: Can't Load Embedded Driver 

Hi Roy, 

What is the full command line which you use to run your application? 

Thanks, 
-Rick 

On 8/8/11 3:06 PM, Roy.Minet@comcast.net wrote: 
> Thanks for the suggestion, Myrna.  However, it's NOT Intellij Idea 
> that is having a problem; everything has been working perfectly in 
> dev.  It's when I build a jar and just run under Windows that the 
> problem occurs.  I'm getting desperate, though, so I'll try   
> "PROGRA~1" and/or moving the jars to somewhere else with no spaces in 
> the path. 
> 
> ------------------------------------------------------------------------ 
> *From: *"Myrna van Lunteren" <m....@gmail.com> 
> *To: *"Derby Discussion" <de...@db.apache.org> 
> *Sent: *Monday, August 8, 2011 5:18:17 PM 
> *Subject: *Re: Can't Load Embedded Driver 
> 
> On Mon, Aug 8, 2011 at 1:53 PM, <Ro...@comcast.net> wrote: 
> > That bottom level plumbing has been working perfectly for two years 
> in dev. 
> > I remember thinking it was pretty cool and developer-friendly.  I had 
> > essentially NO trouble getting it all up and working.  I have now 
> added the 
> > code to explicitly load the driver.  It works fine in dev, but not 
> deployed 
> > in a jar (java.lang.ClassNotFoundException: 
> > org.apache.derby.jdbc.EmbeddedDriver).  CLASSPATH surely would be 
> the usual 
> > suspect, but echo %CLASSPATH% yields "C:\Program 
> > Files\Apache\db-derby-10.8.1.2-bin\lib\derby.jar;." (derby.jar 
> really IS in 
> > that location) and  java org.apache.derby.jdbc.EmbeddedDriver yields 
> > "Exception in thread "main" java.lang.NoSuchMethodError: main" as 
> Rick says 
> > it should.  So, WTF am I doing wrong?  In Unix, I would have 
> double-checked 
> > rwx permissions (maybe Intellij Idea is running as root), but I'm not as 
> > familiar with this stuff in Windows. 
> > 
> > ________________________________ 
> > From: "Rick Hillegas" <ri...@oracle.com> 
> > To: "Derby Discussion" <de...@db.apache.org> 
> > Sent: Monday, August 8, 2011 3:24:09 PM 
> > Subject: Re: Can't Load Embedded Driver 
> > 
> > Hi Roy, 
> > 
> > Thanks for including the code snippet. As Raymond points out, you are 
> > not loading the driver explicitly. This should not be necessary if you 
> > are using Java 6 or 7. However, driver autoloading does not happen in 
> > Java 5 and earlier versions of Java. What version of Java are you using? 
> > 
> > Thanks, 
> > -Rick 
> > 
> > On 8/8/11 11:55 AM, Raymond Kroeker wrote: 
> >> 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_driver 
> >> 
> >> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); 
> >> 
> >> Raymond 
> >> 
> >> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote: 
> >>> I do not know what an "fqcn" is.  I am running the latest Derby 
> release, 
> >>> 10.8.1.2.  The code pasted in below works great in the dev environment 
> >>> (IntelliJ Idea), but the same code packaged in a jar cannot find the 
> >>> driver 
> >>> with CLASSPATH set correctly. 
> >>> 
> >>>     public static Connection getConnection() 
> >>>     { 
> >>>        Connection c = null; 
> >>>        try 
> >>>        {             // The connectionURL 
> >>> is "jdbc:derby:EMDatabase;create=true" 
> >>>           c = DriverManager.getConnection(connectionURL); 
> >>>           c.setAutoCommit(false); 
> >>>        } 
> >>>        catch (Throwable e) 
> >>>        { 
> >>>           log(3, "Unable to connect to " + dbName + ":  " + 
> >>> e.getMessage()); 
> >>>           stopDBMS(); 
> >>>           System.exit(3); 
> >>>        } 
> >>>        return c; 
> >>>     } 
> >>> 
> >>> 
> >>> 
> >>> ________________________________ 
> >>> 
> >>> From: "Raymond Kroeker"<ra...@gmail.com> 
> >>> 
> >>> To: "Derby Discussion"<de...@db.apache.org> 
> >>> 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 
> >>> issue 
> >>> please paste relevant code around how you load the driver and obtain a 
> >>> connection. 
> >>> 
> >>> Raymond 
> >>> 
> >>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote: 
> >>>> 
> >>>> Rick, 
> >>>> 
> >>>> 
> >>>> 
> >>>> Thank you very much for offering your help.  Apparently my 
> CLASSPATH is 
> >>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did 
> >>>> indeed 
> >>>> get exactly the expected "Exception in thread "main" 
> >>>> java.lang.NoSuchMethodError: main" error message.  What else could be 
> >>>> causing  my problem? 
> >>>> 
> >>>> 
> >>>> 
> >>>> Roy 
> >>>> 
> >>>> 
> >>>> 
> >>>> 
> >>>> 
> >>>> ----- Original Message ----- 
> >>>> 
> >>>> 
> >>>> From: "Rick Hillegas"<ri...@oracle.com> 
> >>>> To: "Derby Discussion"<de...@db.apache.org> 
> >>>> 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.  The embedded 
> >>>>> driver doesn't load; the error message is, "No suitable driver found 
> >>>>> for jdbc:derby:EMDatabase;create=true".  I'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 
> >> 
> >> 
> > 
> Looks like it should work. Perhaps derby/intelliJ Idea/the jvm has 
> trouble with the space in the classpath. I think with some tools I 
> have to use the 8 character DOS equivalent (e.g. Progra~1 instead of 
> Program Files) when I refer to directory names with spaces. 
> 
> So, perhaps it's worth a quick try to see if it works if you plop 
> derby.jar and/or your other jar somewhere else than in the Program 
> Files directory (and adjust the classpath too, of course). 
> 
> Myrna 


Re: Can't Load Embedded Driver

Posted by Rick Hillegas <ri...@oracle.com>.
Hi Roy,

What is the full command line which you use to run your application?

Thanks,
-Rick

On 8/8/11 3:06 PM, Roy.Minet@comcast.net wrote:
> Thanks for the suggestion, Myrna.  However, it's NOT Intellij Idea 
> that is having a problem; everything has been working perfectly in 
> dev.  It's when I build a jar and just run under Windows that the 
> problem occurs.  I'm getting desperate, though, so I'll try  
> "PROGRA~1" and/or moving the jars to somewhere else with no spaces in 
> the path.
>
> ------------------------------------------------------------------------
> *From: *"Myrna van Lunteren" <m....@gmail.com>
> *To: *"Derby Discussion" <de...@db.apache.org>
> *Sent: *Monday, August 8, 2011 5:18:17 PM
> *Subject: *Re: Can't Load Embedded Driver
>
> On Mon, Aug 8, 2011 at 1:53 PM, <Ro...@comcast.net> wrote:
> > That bottom level plumbing has been working perfectly for two years 
> in dev.
> > I remember thinking it was pretty cool and developer-friendly.  I had
> > essentially NO trouble getting it all up and working.  I have now 
> added the
> > code to explicitly load the driver.  It works fine in dev, but not 
> deployed
> > in a jar (java.lang.ClassNotFoundException:
> > org.apache.derby.jdbc.EmbeddedDriver).  CLASSPATH surely would be 
> the usual
> > suspect, but echo %CLASSPATH% yields "C:\Program
> > Files\Apache\db-derby-10.8.1.2-bin\lib\derby.jar;." (derby.jar 
> really IS in
> > that location) and  java org.apache.derby.jdbc.EmbeddedDriver yields
> > "Exception in thread "main" java.lang.NoSuchMethodError: main" as 
> Rick says
> > it should.  So, WTF am I doing wrong?  In Unix, I would have 
> double-checked
> > rwx permissions (maybe Intellij Idea is running as root), but I'm not as
> > familiar with this stuff in Windows.
> >
> > ________________________________
> > From: "Rick Hillegas" <ri...@oracle.com>
> > To: "Derby Discussion" <de...@db.apache.org>
> > Sent: Monday, August 8, 2011 3:24:09 PM
> > Subject: Re: Can't Load Embedded Driver
> >
> > Hi Roy,
> >
> > Thanks for including the code snippet. As Raymond points out, you are
> > not loading the driver explicitly. This should not be necessary if you
> > are using Java 6 or 7. However, driver autoloading does not happen in
> > Java 5 and earlier versions of Java. What version of Java are you using?
> >
> > Thanks,
> > -Rick
> >
> > On 8/8/11 11:55 AM, Raymond Kroeker wrote:
> >> 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_driver
> >>
> >> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
> >>
> >> Raymond
> >>
> >> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote:
> >>> I do not know what an "fqcn" is.  I am running the latest Derby 
> release,
> >>> 10.8.1.2.  The code pasted in below works great in the dev environment
> >>> (IntelliJ Idea), but the same code packaged in a jar cannot find the
> >>> driver
> >>> with CLASSPATH set correctly.
> >>>
> >>>     public static Connection getConnection()
> >>>     {
> >>>        Connection c = null;
> >>>        try
> >>>        {             // The connectionURL
> >>> is "jdbc:derby:EMDatabase;create=true"
> >>>           c = DriverManager.getConnection(connectionURL);
> >>>           c.setAutoCommit(false);
> >>>        }
> >>>        catch (Throwable e)
> >>>        {
> >>>           log(3, "Unable to connect to " + dbName + ":  " +
> >>> e.getMessage());
> >>>           stopDBMS();
> >>>           System.exit(3);
> >>>        }
> >>>        return c;
> >>>     }
> >>>
> >>>
> >>>
> >>> ________________________________
> >>>
> >>> From: "Raymond Kroeker"<ra...@gmail.com>
> >>>
> >>> To: "Derby Discussion"<de...@db.apache.org>
> >>> 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
> >>> issue
> >>> please paste relevant code around how you load the driver and obtain a
> >>> connection.
> >>>
> >>> Raymond
> >>>
> >>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote:
> >>>>
> >>>> Rick,
> >>>>
> >>>>
> >>>>
> >>>> Thank you very much for offering your help.  Apparently my 
> CLASSPATH is
> >>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did
> >>>> indeed
> >>>> get exactly the expected "Exception in thread "main"
> >>>> java.lang.NoSuchMethodError: main" error message.  What else could be
> >>>> causing  my problem?
> >>>>
> >>>>
> >>>>
> >>>> Roy
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ----- Original Message -----
> >>>>
> >>>>
> >>>> From: "Rick Hillegas"<ri...@oracle.com>
> >>>> To: "Derby Discussion"<de...@db.apache.org>
> >>>> 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.  The embedded
> >>>>> driver doesn't load; the error message is, "No suitable driver found
> >>>>> for jdbc:derby:EMDatabase;create=true".  I'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
> >>
> >>
> >
> Looks like it should work. Perhaps derby/intelliJ Idea/the jvm has
> trouble with the space in the classpath. I think with some tools I
> have to use the 8 character DOS equivalent (e.g. Progra~1 instead of
> Program Files) when I refer to directory names with spaces.
>
> So, perhaps it's worth a quick try to see if it works if you plop
> derby.jar and/or your other jar somewhere else than in the Program
> Files directory (and adjust the classpath too, of course).
>
> Myrna


Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.
Thanks for the suggestion, Myrna.  However, it's NOT Intellij Idea that is having a problem; everything has been working perfectly in dev.  It's when I build a jar and just run under Windows that the problem occurs.  I'm getting desperate, though, so I'll try  "PROGRA~1" and/or  moving the jars to somewhere else  with no spaces in the path. 

----- Original Message -----
From: "Myrna van Lunteren" <m....@gmail.com> 
To: "Derby Discussion" <de...@db.apache.org> 
Sent: Monday, August 8, 2011 5:18:17 PM 
Subject: Re: Can't Load Embedded Driver 

On Mon, Aug 8, 2011 at 1:53 PM,  <Ro...@comcast.net> wrote: 
> That bottom level plumbing has been working perfectly for two years in dev. 
> I remember thinking it was pretty cool and developer-friendly.  I had 
> essentially NO trouble getting it all up and working.  I have now added the 
> code to explicitly load the driver.  It works fine in dev, but not deployed 
> in a jar (java.lang.ClassNotFoundException: 
> org.apache.derby.jdbc.EmbeddedDriver).  CLASSPATH surely would be the usual 
> suspect, but echo %CLASSPATH% yields "C:\Program 
> Files\Apache\db-derby-10.8.1.2-bin\lib\derby.jar;." (derby.jar really IS in 
> that location) and  java org.apache.derby.jdbc.EmbeddedDriver yields 
> "Exception in thread "main" java.lang.NoSuchMethodError: main" as Rick says 
> it should.  So, WTF am I doing wrong?  In Unix, I would have double-checked 
> rwx permissions (maybe Intellij Idea is running as root), but I'm not as 
> familiar with this stuff in Windows. 
> 
> ________________________________ 
> From: "Rick Hillegas" <ri...@oracle.com> 
> To: "Derby Discussion" <de...@db.apache.org> 
> Sent: Monday, August 8, 2011 3:24:09 PM 
> Subject: Re: Can't Load Embedded Driver 
> 
> Hi Roy, 
> 
> Thanks for including the code snippet. As Raymond points out, you are 
> not loading the driver explicitly. This should not be necessary if you 
> are using Java 6 or 7. However, driver autoloading does not happen in 
> Java 5 and earlier versions of Java. What version of Java are you using? 
> 
> Thanks, 
> -Rick 
> 
> On 8/8/11 11:55 AM, Raymond Kroeker wrote: 
>> 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_driver 
>> 
>> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); 
>> 
>> Raymond 
>> 
>> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote: 
>>> I do not know what an "fqcn" is.  I am running the latest Derby release, 
>>> 10.8.1.2.  The code pasted in below works great in the dev environment 
>>> (IntelliJ Idea), but the same code packaged in a jar cannot find the 
>>> driver 
>>> with CLASSPATH set correctly. 
>>> 
>>>     public static Connection getConnection() 
>>>     { 
>>>        Connection c = null; 
>>>        try 
>>>        {             // The connectionURL 
>>> is "jdbc:derby:EMDatabase;create=true" 
>>>           c = DriverManager.getConnection(connectionURL); 
>>>           c.setAutoCommit(false); 
>>>        } 
>>>        catch (Throwable e) 
>>>        { 
>>>           log(3, "Unable to connect to " + dbName + ":  " + 
>>> e.getMessage()); 
>>>           stopDBMS(); 
>>>           System.exit(3); 
>>>        } 
>>>        return c; 
>>>     } 
>>> 
>>> 
>>> 
>>> ________________________________ 
>>> 
>>> From: "Raymond Kroeker"<ra...@gmail.com> 
>>> 
>>> To: "Derby Discussion"<de...@db.apache.org> 
>>> 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 
>>> issue 
>>> please paste relevant code around how you load the driver and obtain a 
>>> connection. 
>>> 
>>> Raymond 
>>> 
>>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote: 
>>>> 
>>>> Rick, 
>>>> 
>>>> 
>>>> 
>>>> Thank you very much for offering your help.  Apparently my CLASSPATH is 
>>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did 
>>>> indeed 
>>>> get exactly the expected "Exception in thread "main" 
>>>> java.lang.NoSuchMethodError: main" error message.  What else could be 
>>>> causing  my problem? 
>>>> 
>>>> 
>>>> 
>>>> Roy 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ----- Original Message ----- 
>>>> 
>>>> 
>>>> From: "Rick Hillegas"<ri...@oracle.com> 
>>>> To: "Derby Discussion"<de...@db.apache.org> 
>>>> 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.  The embedded 
>>>>> driver doesn't load; the error message is, "No suitable driver found 
>>>>> for jdbc:derby:EMDatabase;create=true".  I'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 
>> 
>> 
> 
Looks like it should work. Perhaps derby/intelliJ Idea/the jvm has 
trouble with the space in the classpath. I think with some tools I 
have to use the 8 character DOS equivalent (e.g. Progra~1 instead of 
Program Files) when I refer to directory names with spaces. 

So, perhaps it's worth a quick try to see if it works if you plop 
derby.jar and/or your other jar somewhere else than in the Program 
Files directory (and adjust the classpath too, of course). 

Myrna 

Re: Can't Load Embedded Driver

Posted by Myrna van Lunteren <m....@gmail.com>.
On Mon, Aug 8, 2011 at 1:53 PM,  <Ro...@comcast.net> wrote:
> That bottom level plumbing has been working perfectly for two years in dev.
> I remember thinking it was pretty cool and developer-friendly.  I had
> essentially NO trouble getting it all up and working.  I have now added the
> code to explicitly load the driver.  It works fine in dev, but not deployed
> in a jar (java.lang.ClassNotFoundException:
> org.apache.derby.jdbc.EmbeddedDriver).  CLASSPATH surely would be the usual
> suspect, but echo %CLASSPATH% yields "C:\Program
> Files\Apache\db-derby-10.8.1.2-bin\lib\derby.jar;." (derby.jar really IS in
> that location) and  java org.apache.derby.jdbc.EmbeddedDriver yields
> "Exception in thread "main" java.lang.NoSuchMethodError: main" as Rick says
> it should.  So, WTF am I doing wrong?  In Unix, I would have double-checked
> rwx permissions (maybe Intellij Idea is running as root), but I'm not as
> familiar with this stuff in Windows.
>
> ________________________________
> From: "Rick Hillegas" <ri...@oracle.com>
> To: "Derby Discussion" <de...@db.apache.org>
> Sent: Monday, August 8, 2011 3:24:09 PM
> Subject: Re: Can't Load Embedded Driver
>
> Hi Roy,
>
> Thanks for including the code snippet. As Raymond points out, you are
> not loading the driver explicitly. This should not be necessary if you
> are using Java 6 or 7. However, driver autoloading does not happen in
> Java 5 and earlier versions of Java. What version of Java are you using?
>
> Thanks,
> -Rick
>
> On 8/8/11 11:55 AM, Raymond Kroeker wrote:
>> 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_driver
>>
>> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
>>
>> Raymond
>>
>> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote:
>>> I do not know what an "fqcn" is.  I am running the latest Derby release,
>>> 10.8.1.2.  The code pasted in below works great in the dev environment
>>> (IntelliJ Idea), but the same code packaged in a jar cannot find the
>>> driver
>>> with CLASSPATH set correctly.
>>>
>>>     public static Connection getConnection()
>>>     {
>>>        Connection c = null;
>>>        try
>>>        {             // The connectionURL
>>> is "jdbc:derby:EMDatabase;create=true"
>>>           c = DriverManager.getConnection(connectionURL);
>>>           c.setAutoCommit(false);
>>>        }
>>>        catch (Throwable e)
>>>        {
>>>           log(3, "Unable to connect to " + dbName + ":  " +
>>> e.getMessage());
>>>           stopDBMS();
>>>           System.exit(3);
>>>        }
>>>        return c;
>>>     }
>>>
>>>
>>>
>>> ________________________________
>>>
>>> From: "Raymond Kroeker"<ra...@gmail.com>
>>>
>>> To: "Derby Discussion"<de...@db.apache.org>
>>> 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
>>> issue
>>> please paste relevant code around how you load the driver and obtain a
>>> connection.
>>>
>>> Raymond
>>>
>>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote:
>>>>
>>>> Rick,
>>>>
>>>>
>>>>
>>>> Thank you very much for offering your help.  Apparently my CLASSPATH is
>>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did
>>>> indeed
>>>> get exactly the expected "Exception in thread "main"
>>>> java.lang.NoSuchMethodError: main" error message.  What else could be
>>>> causing  my problem?
>>>>
>>>>
>>>>
>>>> Roy
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ----- Original Message -----
>>>>
>>>>
>>>> From: "Rick Hillegas"<ri...@oracle.com>
>>>> To: "Derby Discussion"<de...@db.apache.org>
>>>> 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.  The embedded
>>>>> driver doesn't load; the error message is, "No suitable driver found
>>>>> for jdbc:derby:EMDatabase;create=true".  I'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
>>
>>
>
Looks like it should work. Perhaps derby/intelliJ Idea/the jvm has
trouble with the space in the classpath. I think with some tools I
have to use the 8 character DOS equivalent (e.g. Progra~1 instead of
Program Files) when I refer to directory names with spaces.

So, perhaps it's worth a quick try to see if it works if you plop
derby.jar and/or your other jar somewhere else than in the Program
Files directory (and adjust the classpath too, of course).

Myrna

Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.
Using jdk1.6.0_20. 

----- Original Message -----
From: "Rick Hillegas" <ri...@oracle.com> 
To: "Derby Discussion" <de...@db.apache.org> 
Sent: Monday, August 8, 2011 3:24:09 PM 
Subject: Re: Can't Load Embedded Driver 

Hi Roy, 

Thanks for including the code snippet. As Raymond points out, you are 
not loading the driver explicitly. This should not be necessary if you 
are using Java 6 or 7. However, driver autoloading does not happen in 
Java 5 and earlier versions of Java. What version of Java are you using? 

Thanks, 
-Rick 

On 8/8/11 11:55 AM, Raymond Kroeker wrote: 
> 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_driver 
> 
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); 
> 
> Raymond 
> 
> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote: 
>> I do not know what an "fqcn" is.  I am running the latest Derby release, 
>> 10.8.1.2.  The code pasted in below works great in the dev environment 
>> (IntelliJ Idea), but the same code packaged in a jar cannot find the driver 
>> with CLASSPATH set correctly. 
>> 
>>     public static Connection getConnection() 
>>     { 
>>        Connection c = null; 
>>        try 
>>        {             // The connectionURL 
>> is "jdbc:derby:EMDatabase;create=true" 
>>           c = DriverManager.getConnection(connectionURL); 
>>           c.setAutoCommit(false); 
>>        } 
>>        catch (Throwable e) 
>>        { 
>>           log(3, "Unable to connect to " + dbName + ":  " + e.getMessage()); 
>>           stopDBMS(); 
>>           System.exit(3); 
>>        } 
>>        return c; 
>>     } 
>> 
>> 
>> 
>> ________________________________ 
>> 
>> From: "Raymond Kroeker"<ra...@gmail.com> 
>> 
>> To: "Derby Discussion"<de...@db.apache.org> 
>> 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 issue 
>> please paste relevant code around how you load the driver and obtain a 
>> connection. 
>> 
>> Raymond 
>> 
>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote: 
>>> 
>>> Rick, 
>>> 
>>> 
>>> 
>>> Thank you very much for offering your help.  Apparently my CLASSPATH is 
>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed 
>>> get exactly the expected "Exception in thread "main" 
>>> java.lang.NoSuchMethodError: main" error message.  What else could be 
>>> causing  my problem? 
>>> 
>>> 
>>> 
>>> Roy 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ----- Original Message ----- 
>>> 
>>> 
>>> From: "Rick Hillegas"<ri...@oracle.com> 
>>> To: "Derby Discussion"<de...@db.apache.org> 
>>> 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.  The embedded 
>>>> driver doesn't load; the error message is, "No suitable driver found 
>>>> for jdbc:derby:EMDatabase;create=true".  I'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 
> 
> 


Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.
That bottom level plumbing has been working perfectly for two years in dev.  I remember thinking it was pretty cool and developer-friendly.  I had essentially NO trouble getting it all up and working.  I have now added the code to explicitly load the driver.  It works fine in dev, but not deployed in a jar (java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver).  CLASSPATH surely would be the usual suspect, but echo %CLASSPATH% yields " C:\Program Files\Apache\db-derby-10.8.1.2-bin\lib\derby.jar;." (derby.jar really IS in that location)  and  java org.apache.derby.jdbc.EmbeddedDriver yields "Exception in thread "main" java.lang.NoSuchMethodError: main" as Rick says it should.  So, WTF am I doing wrong?  In Unix, I would have double-checked rwx permissions (maybe Intellij Idea is running as root) , but I'm not as familiar with this stuff in Windows. 

----- Original Message -----
From: "Rick Hillegas" <ri...@oracle.com> 
To: "Derby Discussion" <de...@db.apache.org> 
Sent: Monday, August 8, 2011 3:24:09 PM 
Subject: Re: Can't Load Embedded Driver 

Hi Roy, 

Thanks for including the code snippet. As Raymond points out, you are 
not loading the driver explicitly. This should not be necessary if you 
are using Java 6 or 7. However, driver autoloading does not happen in 
Java 5 and earlier versions of Java. What version of Java are you using? 

Thanks, 
-Rick 

On 8/8/11 11:55 AM, Raymond Kroeker wrote: 
> 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_driver 
> 
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); 
> 
> Raymond 
> 
> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote: 
>> I do not know what an "fqcn" is.  I am running the latest Derby release, 
>> 10.8.1.2.  The code pasted in below works great in the dev environment 
>> (IntelliJ Idea), but the same code packaged in a jar cannot find the driver 
>> with CLASSPATH set correctly. 
>> 
>>     public static Connection getConnection() 
>>     { 
>>        Connection c = null; 
>>        try 
>>        {             // The connectionURL 
>> is "jdbc:derby:EMDatabase;create=true" 
>>           c = DriverManager.getConnection(connectionURL); 
>>           c.setAutoCommit(false); 
>>        } 
>>        catch (Throwable e) 
>>        { 
>>           log(3, "Unable to connect to " + dbName + ":  " + e.getMessage()); 
>>           stopDBMS(); 
>>           System.exit(3); 
>>        } 
>>        return c; 
>>     } 
>> 
>> 
>> 
>> ________________________________ 
>> 
>> From: "Raymond Kroeker"<ra...@gmail.com> 
>> 
>> To: "Derby Discussion"<de...@db.apache.org> 
>> 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 issue 
>> please paste relevant code around how you load the driver and obtain a 
>> connection. 
>> 
>> Raymond 
>> 
>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote: 
>>> 
>>> Rick, 
>>> 
>>> 
>>> 
>>> Thank you very much for offering your help.  Apparently my CLASSPATH is 
>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed 
>>> get exactly the expected "Exception in thread "main" 
>>> java.lang.NoSuchMethodError: main" error message.  What else could be 
>>> causing  my problem? 
>>> 
>>> 
>>> 
>>> Roy 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ----- Original Message ----- 
>>> 
>>> 
>>> From: "Rick Hillegas"<ri...@oracle.com> 
>>> To: "Derby Discussion"<de...@db.apache.org> 
>>> 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.  The embedded 
>>>> driver doesn't load; the error message is, "No suitable driver found 
>>>> for jdbc:derby:EMDatabase;create=true".  I'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 
> 
> 


Re: Can't Load Embedded Driver

Posted by Rick Hillegas <ri...@oracle.com>.
Hi Roy,

Thanks for including the code snippet. As Raymond points out, you are 
not loading the driver explicitly. This should not be necessary if you 
are using Java 6 or 7. However, driver autoloading does not happen in 
Java 5 and earlier versions of Java. What version of Java are you using?

Thanks,
-Rick

On 8/8/11 11:55 AM, Raymond Kroeker wrote:
> 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_driver
>
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
>
> Raymond
>
> On Mon, Aug 8, 2011 at 11:47,<Ro...@comcast.net>  wrote:
>> I do not know what an "fqcn" is.  I am running the latest Derby release,
>> 10.8.1.2.  The code pasted in below works great in the dev environment
>> (IntelliJ Idea), but the same code packaged in a jar cannot find the driver
>> with CLASSPATH set correctly.
>>
>>     public static Connection getConnection()
>>     {
>>        Connection c = null;
>>        try
>>        {             // The connectionURL
>> is "jdbc:derby:EMDatabase;create=true"
>>           c = DriverManager.getConnection(connectionURL);
>>           c.setAutoCommit(false);
>>        }
>>        catch (Throwable e)
>>        {
>>           log(3, "Unable to connect to " + dbName + ":  " + e.getMessage());
>>           stopDBMS();
>>           System.exit(3);
>>        }
>>        return c;
>>     }
>>
>>
>>
>> ________________________________
>>
>> From: "Raymond Kroeker"<ra...@gmail.com>
>>
>> To: "Derby Discussion"<de...@db.apache.org>
>> 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 issue
>> please paste relevant code around how you load the driver and obtain a
>> connection.
>>
>> Raymond
>>
>> On Aug 8, 2011 6:55 AM,<Ro...@comcast.net>  wrote:
>>>
>>> Rick,
>>>
>>>
>>>
>>> Thank you very much for offering your help.  Apparently my CLASSPATH is
>>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed
>>> get exactly the expected "Exception in thread "main"
>>> java.lang.NoSuchMethodError: main" error message.  What else could be
>>> causing  my problem?
>>>
>>>
>>>
>>> Roy
>>>
>>>
>>>
>>>
>>>
>>> ----- Original Message -----
>>>
>>>
>>> From: "Rick Hillegas"<ri...@oracle.com>
>>> To: "Derby Discussion"<de...@db.apache.org>
>>> 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.  The embedded
>>>> driver doesn't load; the error message is, "No suitable driver found
>>>> for jdbc:derby:EMDatabase;create=true".  I'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
>
>


Re: Can't Load Embedded Driver

Posted by Raymond Kroeker <ra...@gmail.com>.
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_driver

Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();

Raymond

On Mon, Aug 8, 2011 at 11:47,  <Ro...@comcast.net> wrote:
> I do not know what an "fqcn" is.  I am running the latest Derby release,
> 10.8.1.2.  The code pasted in below works great in the dev environment
> (IntelliJ Idea), but the same code packaged in a jar cannot find the driver
> with CLASSPATH set correctly.
>
>    public static Connection getConnection()
>    {
>       Connection c = null;
>       try
>       {             // The connectionURL
> is "jdbc:derby:EMDatabase;create=true"
>          c = DriverManager.getConnection(connectionURL);
>          c.setAutoCommit(false);
>       }
>       catch (Throwable e)
>       {
>          log(3, "Unable to connect to " + dbName + ":  " + e.getMessage());
>          stopDBMS();
>          System.exit(3);
>       }
>       return c;
>    }
>
>
>
> ________________________________
>
> From: "Raymond Kroeker" <ra...@gmail.com>
>
> To: "Derby Discussion" <de...@db.apache.org>
> 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 issue
> please paste relevant code around how you load the driver and obtain a
> connection.
>
> Raymond
>
> On Aug 8, 2011 6:55 AM, <Ro...@comcast.net> wrote:
>>
>>
>> Rick,
>>
>>
>>
>> Thank you very much for offering your help.  Apparently my CLASSPATH is
>> good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed
>> get exactly the expected "Exception in thread "main"
>> java.lang.NoSuchMethodError: main" error message.  What else could be
>> causing  my problem?
>>
>>
>>
>> Roy
>>
>>
>>
>>
>>
>> ----- Original Message -----
>>
>>
>> From: "Rick Hillegas" <ri...@oracle.com>
>> To: "Derby Discussion" <de...@db.apache.org>
>> 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.  The embedded
>>> driver doesn't load; the error message is, "No suitable driver found
>>> for jdbc:derby:EMDatabase;create=true".  I'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
>



-- 
---------------------------------------------------------
Raymond Kroeker

Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.

I do not know what an "fqcn" is.  I am running the latest Derby release, 10.8.1.2.  The code pasted in below works great  in the dev environment (IntelliJ Idea), but the same code packaged in a jar cannot find the driver with CLASSPATH set correctly. 

   public static Connection getConnection() 
   { 
      Connection c = null; 
      try 
      {             // The connectionURL is "jdbc:derby:EMDatabase;create=true " 
         c = DriverManager.getConnection(connectionURL); 
         c.setAutoCommit(false); 
      } 
      catch (Throwable e) 
      { 
         log(3, "Unable to connect to " + dbName + ":  " + e.getMessage()); 
         stopDBMS(); 
         System.exit(3); 
      } 
      return c; 
   } 




----- Original Message -----


From: "Raymond Kroeker" <ra...@gmail.com> 
To: "Derby Discussion" <de...@db.apache.org> 
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 issue please paste relevant code around how you load the driver and obtain a connection. 

Raymond 
On Aug 8, 2011 6:55 AM, < Roy.Minet@comcast.net > wrote: 
> 
> 
> Rick, 
> 
> 
> 
> Thank you very much for offering your help.  Apparently my CLASSPATH is good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed get exactly the expected "Exception in thread "main" java.lang.NoSuchMethodError: main" error message.  What else could be causing  my problem? 
> 
> 
> 
> Roy 
> 
> 
> 
> 
> 
> ----- Original Message ----- 
> 
> 
> From: "Rick Hillegas" < rick.hillegas@oracle.com > 
> To: "Derby Discussion" < derby-user@db.apache.org > 
> 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.  The embedded 
>> driver doesn't load; the error message is, "No suitable driver found 
>> for jdbc:derby:EMDatabase;create=true".  I'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 

Re: Can't Load Embedded Driver

Posted by Raymond Kroeker <ra...@gmail.com>.
Can you try specifying the driver as a fqcn? If that doesn't solve the issue
please paste relevant code around how you load the driver and obtain a
connection.

Raymond
On Aug 8, 2011 6:55 AM, <Ro...@comcast.net> wrote:
>
>
> Rick,
>
>
>
> Thank you very much for offering your help.  Apparently my CLASSPATH is
good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed
get exactly the expected "Exception in thread "main"
java.lang.NoSuchMethodError: main" error message.  What else could be
causing  my problem?
>
>
>
> Roy
>
>
>
>
>
> ----- Original Message -----
>
>
> From: "Rick Hillegas" <ri...@oracle.com>
> To: "Derby Discussion" <de...@db.apache.org>
> 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.  The embedded
>> driver doesn't load; the error message is, "No suitable driver found
>> for jdbc:derby:EMDatabase;create=true".  I'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

Re: Can't Load Embedded Driver

Posted by Ro...@comcast.net.

Rick, 



Thank you very much for offering your help.  Apparently my CLASSPATH is good.  I typed in "java org.apache.derby.jdbc.EmbeddedDriver" and did indeed get exactly the expected "Exception in thread "main" java.lang.NoSuchMethodError: main" error message.  What else could be causing  my problem? 



Roy 





----- Original Message -----


From: "Rick Hillegas" <ri...@oracle.com> 
To: "Derby Discussion" <de...@db.apache.org> 
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.  The embedded 
> driver doesn't load; the error message is, "No suitable driver found 
> for jdbc:derby:EMDatabase;create=true".  I'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 

Re: Can't Load Embedded Driver

Posted by Rick Hillegas <ri...@oracle.com>.
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.  The embedded 
> driver doesn't load; the error message is, "No suitable driver found 
> for jdbc:derby:EMDatabase;create=true".  I'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

Re: Can't Load Embedded Driver

Posted by Máximo Castillo <ma...@gmail.com>.
I have some experience using Apache Derby. I can't remember exactly what was
the issue I found in my project. It worked on DEV but not in PRD. I fixed it
using derby.properties file.

Do some research and take a look a derby.properties file:

http://db.apache.org/derby/docs/dev/devguide/cdevdvlp39943.html



Max

On Mon, Aug 8, 2011 at 10:58 AM, Dag H. Wanvik <da...@oracle.com>wrote:

> **
> On 07.08.2011 18:54, 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.  The embedded driver doesn't
> load; the error message is, "No suitable driver found for
> jdbc:derby:EMDatabase;create=true".  I'm under Windows XP Pro.  Any help
> would be appreciated.
>
>
>
> Roy Minet
>
>  YOu can try to add Class.forName("org.apache.derby.jdbc.EmbeddedDriver")
> in the app before trying to connect, unless you have a recent Derby version
> in which case it shoul dnot be needed. Autoloading of the driver was
> introduced in Derby 10.2.
> If you have a Derby version newer that 10.2, it sounds like a CLASSPATH
> issue.
>
> If you run this command with the same classpath as you app, what do you
> see?
>
> > java org.apache.derby.tools.sysinfo
>
> It should the jar versions found on the classpath.
>
> Dag
>
>

Re: Can't Load Embedded Driver

Posted by "Dag H. Wanvik" <da...@oracle.com>.
On 07.08.2011 18:54, 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.  The embedded 
> driver doesn't load; the error message is, "No suitable driver found 
> for jdbc:derby:EMDatabase;create=true".  I'm under Windows XP Pro.  
> Any help would be appreciated.
>
> Roy Minet
>
>
YOu can try to add Class.forName("org.apache.derby.jdbc.EmbeddedDriver") 
in the app before trying to connect, unless you have a recent Derby 
version in which case it shoul dnot be needed. Autoloading of the driver 
was introduced in Derby 10.2.
If you have a Derby version newer that 10.2, it sounds like a CLASSPATH 
issue.

If you run this command with the same classpath as you app, what do you see?

 > java org.apache.derby.tools.sysinfo

It should the jar versions found on the classpath.

Dag