← Back to team overview

gephi.team team mailing list archive

[Question #150782]: Cannot connect using DB Connector plugin

 

Question #150782 on Gephi changed:
https://answers.launchpad.net/gephi/+question/150782

Description changed to:
I have a JDBC and I have created a new module to write a DB Connector. I
have added the JDBC to the module and created a class that implements
SQLDriver, I understand that I will need to override the implementation
for the following. I might have missed something as it doesn't work. So
far I have the following class in my module:

public class TestSQLDriver implements SQLDriver{

public Connection getConnection(String connectionUrl, String username, String passwd) throws SQLException {
        return DriverManager.getConnection(connectionUrl, username, passwd);
    }

@Override
    public String getPrefix() {
        return "jdbc:test://tom/will;user=admin;password=password;loglevel=2;logdirpath=C:\\";
    }

    @Override
    public String toString() {
        return "New Driver";
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof TestSQLDriver) {
            return ((TestSQLDriver) obj).getPrefix().equals(getPrefix());
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return getPrefix().hashCode();
    }
}

My JDBC URL looks something like the following:

jdbc:test://<host>/<database>;user=<username>;password=<password>; 
loglevel=<log level>;logdirpath=<log directory>

But I did not quite understand why it doesn't work. What am I missing
here? Here's the error I am getting:

java.lang.ClassNotFoundException: Will not load classes from default package (TestSQLDriver)
	at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:199)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.openide.util.lookup.MetaInfServicesLookup.search(MetaInfServicesLookup.java:285)
	at org.openide.util.lookup.MetaInfServicesLookup.beforeLookup(MetaInfServicesLookup.java:144)
	at org.openide.util.lookup.AbstractLookup$R.beforeLookup(AbstractLookup.java:1127)
	at org.openide.util.lookup.ProxyLookup$R.myBeforeLookup(ProxyLookup.java:666)
	at org.openide.util.lookup.ProxyLookup$R.computeResult(ProxyLookup.java:520)
	at org.openide.util.lookup.ProxyLookup$R.allInstances(ProxyLookup.java:491)
	at org.openide.util.Lookup.lookupAll(Lookup.java:263)
	at org.gephi.ui.importer.plugin.EdgeListDatabaseImporterUI.setup(EdgeListDatabaseImporterUI.java:54)
[catch] at org.gephi.desktop.importer.DesktopImportControllerUI.importDatabase(DesktopImportControllerUI.java:312)

If I get this working I will be writing a tutorial on the wiki on how to
write a DB connector as there isn't any as of now. Can someone guide me
through this.

-- 
You received this question notification because you are a member of
Gephi Team, which is an answer contact for Gephi.