I am trying to have an OSGI bundle access a MYSQL DB, using Eclipse as my IDE (Windows 7 x64). I am able to load the jdbc connector. The actual .jar is placed in all \bin folders in the java install directories, along with the \bin folder of the bundle. I have set the environment classpath variable to this folder also. I have an error stating that the driver is not suitable. I know OSGI has some issues with drivers etc. Can someone recommend a way to circumvent this?
ClassLoader DBHCL = ClassLoader.getSystemClassLoader();
DBHCL.loadClass("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver", true, DBHCL).newInstance();
System.out.println("Class Loaded");
//DriverManager.getDriver("jdbc:mysql://localhost/timedb");
//System.out.println("Driver Gotten");
conn = DriverManager.getConnection(URL + DBName,username,password);
System.out.println("Connection Created");
stmt = conn.createStatement();
System.out.println("Statement Created");
connFlag = true;
Console Output, Error: osgi> start 7 Data Base Service (MYSQL) Starting Class Loaded No suitable driver found for jdbc:mysql://localhost/timedb Exception in thread "Thread-1" INSERT INTO appliance1...
Does anybody have any insight into this problem?
I have tried making a separate bundle solely for the jdbc driver and exporting/importing this to the appropriate bundle, but no luck.
Thanks