aherlambang
aherlambang

Reputation: 14418

Loading a JDBC driver

So I have the following code:

@ServiceProvider(service=org.test.Driver.class)
public class TestLDriver implements SQLDriver{

and the JDBC layout is:

enter image description here

Two problems occured, one is.. am I doing the right thing? The second is that I get an error that this class is not assignable to org.netezza.Driver.class. What am I doing wrong?

When I try to use the

Class.register(Driver.class) it gives me a cannot find symbol error...

Upvotes: 0

Views: 787

Answers (1)

Costis Aivalis
Costis Aivalis

Reputation: 13728

You should load the Driver class like this:

try {
    Class.forName("org.netezza.Driver");
} catch (ClassNotFoundException e) {
    String msg = "Driver is missing\n" +
            "install and rerun the application";
    JOptionPane.showMessageDialog(this, msg, this.getTitle(), JOptionPane.ERROR_MESSAGE);
    System.exit(1);
}

There is no Class.register.

Upvotes: 1

Related Questions