After reading about UCanAccess in this question I've started building it into my app. It seems to be working, but I've noticed an oddity.
I put in the following code at start-up, and found that it doesn't print anything, unless I preface it with a Class.forName("net.ucanaccess.jdbc.UcanaccessDriver")
or other reference to the class. As long as I include that line, it will print out "driver found :..." as expected.
Enumeration<Driver> x = DriverManager.getDrivers();
while (x.hasMoreElements()) {
Driver driver = x.nextElement();
if (driver instanceof UcanaccessDriver) {
System.out.println("driver found: " + driver.toString());
}
}
However, I've seen it in comments on other UCanAccess questions that the Class.forName()
shouldn't be needed before regular calls to DriverManager.getDriver()
or whatever else. Is there a step I've missed?