It is "wrong" but more work to manage imports and drivers especially if you
need to optionally support multiple databases. It is cleaner to configure a
data source and just look it up from your code.
On Dec 23, 2014 6:45 AM, "Richard Snowden" <[email protected]>
wrote:

> I just tried Derby - got the same issue:
> java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
>
> This is what I do to initialize the DB:
> Derby:
>
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
>             dbConnection =
> DriverManager.getConnection("jdbc:derby:memory:myDB;create=true;");
>
> H2:
>             Class.forName("org.h2.Driver");
>             dbConnection = DriverManager.getConnection("jdbc:h2:~/myDB",
> "", "");
>
> Is this wrong?
>
> On Tue, Dec 23, 2014 at 3:37 PM, Jean-Baptiste Onofré <[email protected]>
> wrote:
>
>> Hi Richard,
>>
>> I suspect more an issue in the way that you use the h2 package in your
>> application.
>>
>> Do you have h2 package in Import-Package of your application ?
>> How do you use the driver ? Class.forName() ?
>> Do you use a datasource ?
>>
>> Regards
>> JB
>>
>>
>> On 12/23/2014 03:31 PM, Richard Snowden wrote:
>>
>>> What I did:
>>>
>>> - added H2 Database to my application. It works fine outside of Karaf.
>>>
>>> - installed H2 to Karaf with "install -s mvn:com.h2database/h2/1.4.184"
>>>
>>> I can see the H2 bundle as "Active" (H2 Database Engine).
>>>
>>> But when I install my application bundle in Karaf, I get this:
>>> java.lang.ClassNotFoundException: org.h2.Driver not found
>>>
>>> What's the proper way to install H2 to Karaf?
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [email protected]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>

Reply via email to