Home | Previous Page | Next Page   Connecting to the Database >

Loading IBM Informix JDBC Driver

To load IBM 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.

Once you have loaded IBM Informix JDBC Driver, you are ready to connect to an Informix database or database server.

Windows 2000 Only

If you are writing an applet to be viewed with Microsoft Internet Explorer, you might need to explicitly register IBM 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 IBM Informix JDBC Driver twice, which does not cause a problem.

End of Windows 2000 Only
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]