Using Forte for Java with the Easysoft JDBC-ODBC Bridge to Access ODBC Data Sources
The following links cover two topics related to the use of the Easysoft JDBC-ODBC Bridge with Forte for Java and present modified versions of relevant pages from the Forte on-line documentation.
Adding the Easysoft JDBC-ODBC Bridge driver to Forte
The first step in setting up the Easysoft JDBC-ODBC Bridge is to install the JOB server on the machine on which your ODBC data sources are located. This will typically be a machine different from the one on which you will run Forte for Java.
You must place the Easysoft JDBC-ODBC Bridge driver classes contained in EJOB.jar
into the Forte for Java lib/ext
directory before you start Forte for Java. You cannot mount the driver file in Forte Explorer to start Forte for Java, or place the driver file in the classpath
environment variable.
The Easysoft JDBC-ODBC Bridge driver classes should be downloaded from the machine on which you have installed the JOB Server. Ensure that the JOB Server is running and use your web browser to connect to the web server of the installed JOB Server using a URL of the form:
http://yourmachine:8031/
Note that if you changed the default port for the Easysoft JDBC-ODBC Bridge web server during installation then you will need to use your revised port number.
Click on the link EJOB.jar on the navigation bar of the server administrator and select Save this file to disk. Navigate to the Forte for Java lib/ext
directory. Ensure the file name is set to EJOB.jar
. On Windows platforms you must additionally set the file type to All Files
:
To add the Easysoft JDBC-ODBC Bridge driver:
- Open File>Explorer and select the Runtime tab:
- Right click on Drivers.
Note: Using NetBeans will require the NetBeans Database Explorer module to be installed from the web site to make the Runtime>Databases>Drivers tab visible.
- Choose Add driver.
The Add JDBC Driver dialog box is displayed, enabling a new driver to be added.
Enter the following fields:
Field Description Entry Name The IDE uses this name for display purposes only Easysoft JDBC-ODBC Bridge
Driver The fully qualified driver class name easysoft.sql.jobDriver
Database URL prefix A template for the database URL prefix jdbc:easysoft://machine/DSN[:unicode=on]
The Database URL prefix template field can represent an invalid URL, the correct value for which can be completed later when a connection is made. For additional attribute value pairs, refer to Getting Started.
The driver (usually in a JAR or ZIP archive) must be in the Forte for Java CLASSPATH.
- Click OK to add the new driver to the list:
You can see "
Easysoft JDBC-ODBC Bridge
" in the list of drivers. - Drivers can be removed manually by selecting them in Forte Explorer and clicking Delete, or you can open the property sheet and modify their configuration.
Note that adding a new driver just creates a template for new connections. Forte for Java does not actually try to use that driver or check to make sure it is the correct one until a connection is made using the driver.
To test a connected driver:
- Right-click on the driver or connection in Forte Explorer and select Test Driver from the context menu.
- In the displayed dialog box, enter the connection information (database URL, user name and password) and click OK.
- If all values shown in the output correspond with the actual database, you can use the driver.
- If an "unsupported exception" appears, test to make sure that the data displayed in the output window is valid (for example, that the number of tables or columns in the table corresponds with the actual data). The system returns the "Internal test driver failed" message whenever it finds a return value of 0 or an exception. If your database is empty or a table has no foreign references, the driver might not be the problem.
Connecting to an ODBC data source
There are two ways to open the New Database Connection dialog box, which allows Forte for Java to be connected to a database:
- In the pop-up menu for Databases or for any existing connection, select Add connection.
- In the pop-up menu for a driver select Connect using... to preselect the driver.
Then enter the following:
- Ensure the correct driver name is selected in Driver.
- Provide the JDBC URL for the database connection in Database URL.
This URL typically begins with
jdbc:
, followed by a short code name for the driver, followed by another colon.The rest of the URL depends on the type of driver you are using.
Full details of the JDBC URL for the Easysoft JDBC-ODBC Bridge driver can be found in Getting Started.
To help you get started, existing drivers are provided with templates for the correct URL format; if in doubt, refer to the documentation for the driver you are using.
- Provide a User Name and Password if required by your database configuration.
- Click Remember password during this session to have the IDE remember your password.
Note: The password is saved only for the current Forte for Java session. After restarting Forte for Java the password must be entered again. This feature can be turned on or off in the properties of each connected database in the Explorer.
- Click OK to connect Forte for Java to the database.
- If the connection is successful, a new node appears on the same level as Drivers. The icon for a connected database shows complete:
If the connection attempt fails, Forte for Java displays a dialog box indicating the connection is broken.
- By expanding the nodes underneath the new database connection you can see nodes for tables, views and procedures:
- Right clicking to display the pop-up menu and selecting View Data displays the result of a query showing the data in the table:
To correct the connection:
- Correct the URL in the property sheet.
- Connect to the database by choosing Connect from the pop-up menu.
To disconnect from the database connection:
- Choose Disconnect from the pop-up menu. You cannot browse the database until you reconnect to the database using Connect.