Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Problem importing mysql JDBC driver(java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306)
Problem importing mysql JDBC driver [message #1784067] Thu, 22 March 2018 08:36
Aistis K is currently offline Aistis KFriend
Messages: 4
Registered: March 2018
Junior Member
Hello,

**EDIT: The problem stemmed from me not importing all the needed dependencies that the mysql-connector-java-6.0.6.jar bundle was exporting. So i just copied the whole export section from mysql-connector-java-6.0.6.jar bundle and pasted into the import section of my bundle (obviously for testing only). This seems to solve the problem. **

My bundle is trying to connect to mysql server with:

Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306", "user", "password");


However when i run the bundle in equinox i get:

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306


1) I have tried various ip numbers and ports, all of which i can get to through phpmyadmin, or other means
2) I have tried to add the mysql-connector-java-6.0.6.jar to my build path as an external jar in my eclipse ide and then build the bundle
3) I have tried to make a deployment package out of mysql-connector-java-6.0.6.jar, installed it in equinox (it is shown as being active), then imported the bundle in the bundle that is trying to use it.

Here is my bundle manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Publisher
Bundle-SymbolicName: aistis.mqttcommunication.publisher
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: aistis.mqttcommunication.publisher.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.kura;version="[1.0,2.0)",
 org.eclipse.kura.cloud;version="[1.0,2.0)",
 org.eclipse.kura.configuration;version="[1.0,2.0)",
 org.eclipse.kura.message;version="[1.0,2.0)",
 org.osgi.framework;version="1.8.0",
 org.osgi.service.component;version="1.2.0",
 org.osgi.util.tracker;version="1.5.1",
 org.slf4j;version="1.6.4",
 com.mysql.jdbc;version="6.0.6"
Bundle-ActivationPolicy: lazy

Here is the manifest of the mysql connector bundle:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jdbc
Bundle-SymbolicName: com.mysql.jdbc
Bundle-Version: 6.0.6
Bundle-Vendor: Iamus
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.mysql.cj.api.jdbc;com.mysql.cj.jdbc;version="6.0.6
 ";uses:="javax.management,javax.naming,javax.naming.spi,javax.net.ssl
 ,javax.sql,javax.transaction.xa,javax.xml.parsers,javax.xml.stream,ja
 vax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,jav
 ax.xml.transform.stax,javax.xml.transform.stream,org.xml.sax",com.mys
 ql.cj.api.log;version="6.0.6",com.mysql.cj.core.profiler;version="6.0
 .6",com.mysql.cj.core.util;version="6.0.6",com.mysql.cj.jdbc.util;ver
 sion="6.0.6",com.mysql.cj.jdbc.exceptions;version="6.0.6",com.mysql.c
 j.api.jdbc.interceptors;com.mysql.cj.jdbc.interceptors;version="6.0.6
 ",com.mysql.cj.jdbc.integration.c3p0;version="6.0.6";uses:="com.mchan
 ge.v2.c3p0",com.mysql.cj.jdbc.integration.jboss;version="6.0.6";uses:
 ="org.jboss.resource.adapter.jdbc,org.jboss.resource.adapter.jdbc.ven
 dor",com.mysql.cj.configurations;version="6.0.6",com.mysql.jdbc;versi
 on="6.0.6";uses:="com.mysql.cj.jdbc",com.mysql.cj.api.xdevapi;com.mys
 ql.cj.xdevapi;version="6.0.6";uses:="com.google.protobuf,javax.securi
 ty.auth.callback,javax.security.sasl"
Import-Package: javax.net.ssl;javax.crypto;resolution:=optional,javax.
 xml.parsers;javax.xml.stream;javax.xml.transform;javax.xml.transform.
 dom;javax.xml.transform.sax;javax.xml.transform.stax;javax.xml.transf
 orm.stream;org.w3c.dom;org.xml.sax;org.xml.sax.helpers;resolution:=op
 tional,javax.sql,javax.naming,javax.naming.spi,javax.transaction.xa,j
 avax.management;resolution:=optional,com.mchange.v2.c3p0;version="[0.
 9.1.2, 1.0.0)";resolution:=optional,org.jboss.resource.adapter.jdbc;o
 rg.jboss.resource.adapter.jdbc.vendor;resolution:=optional,org.slf4j;
 resolution:=optional,com.google.protobuf;javax.security.auth.callback
 ;javax.security.sasl;resolution:=optional


4) Also tried to add this line to the Activator class of my bundle (though not exactly sure what this is supposed to do, i just saw it in a forum post):
bundleContext.getBundle().loadClass("com.mysql.jdbc.Driver ").newInstance(); 


5) Also tried adding this:
Class.forName("com.mysql.jdbc.Driver").newInstance();


At this point i'm starting to run out of ideas. I have a suspicion that i might have made some stupid error somewhere, and would be very grateful if someone could lend me a hand here.

[Updated on: Thu, 22 March 2018 18:04]

Report message to a moderator

Previous Topic:how to get bundle context in the servlet registered by the org.eclipse.equinox.http.registry
Next Topic:DS ignores service.ranking?
Goto Forum:
  


Current Time: Fri Sep 21 05:37:01 GMT 2018

Powered by FUDForum. Page generated in 0.01762 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top