Load HCL Informix® JDBC Driver
To load Informix® JDBC
Driver,
use the Class.forName() method, passing it the
value
com.informix.jdbc.IfxDriver
: try
{
Class.forName("com.informix.jdbc.IfxDriver");
}
catch (Exception e)
{
System.out.println("ERROR: failed to load Informix JDBC driver.");
e.printStackTrace();
return;
}
The Class.forName() method loads the Informix® implementation of the Driver class, IfxDriver. IfxDriver then creates an instance of the driver and registers it with the DriverManager class.
After you have loaded Informix® JDBC Driver, you are ready to connect to the Informix® database or database server.
If you are writing an applet to be viewed with Microsoft™ Internet Explorer, you might need to explicitly register Informix® JDBC Driver to avoid platform incompatibilities.
To explicitly register the
driver, use the DriverManager.registerDriver() method:
DriverManager.registerDriver(com.informix.jdbc.IfxDriver)
Class.forName("com.informix.jdbc.IfxDriver").newInstance());
This method might register Informix® JDBC Driver twice, which does not cause a problem.