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, <[email protected]> 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" <[email protected]>
>
> To: "Derby Discussion" <[email protected]>
> 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, <[email protected]> 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" <[email protected]>
>> To: "Derby Discussion" <[email protected]>
>> Sent: Monday, August 8, 2011 9:00:58 AM
>> Subject: Re: Can't Load Embedded Driver
>>
>> On 8/7/11 9:54 AM, [email protected] 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