How to add a JDBC driver in Java


This procedure assumes you are creating a new JDBC data source, and you need to install a new driver because the driver that the database requires is not available in the list of drivers.

1  
In New JDBC Data Source Profile, shown in Figure 2-4, choose Manage Drivers.
Figure 2-4 New JDBC Data Source Profile
3  
Navigate to the directory that contains the JAR file. Select the JAR file and choose Open. Manage JDBC Drivers shows the new JAR file.
Figure 2-5 Viewing JDBC driver classes
*
In Driver Display Name, type a user-friendly name that describes the driver. This name appears in parenthesis next to the driver class name in Driver Class on New JDBC Data Source Profile.
*
In URL Template, type the URL format that the driver requires. This URL format appears in Driver URL on New JDBC Data Source Profile.
 shows an example of properties specified for a MySQL JDBC driver.
Figure 2-6 Properties specified for a JDBC driver
Properties specified for a JDBC driver
6  
In New JDBC Data Source Profile, specify the connection properties to connect to the JDBC data source. The Driver Class list displays the installed driver.

Source: Eclipse

1 comment: