Accessing ODBC data sources from Forte for Java

Contents

Adding the Easysoft JDBC-ODBC Bridge client to Forte

Install the JDBC-ODBC Bridge server on the machine where your ODBC data sources are located. This will typically be a different machine to the Forte for Java one.

Copy the Easysoft JDBC-ODBC Bridge client (EJOB.jar) to the Forte for Java lib/ext directory before you start Forte for Java. You can't mount the client in Forte Explorer to start Forte for Java, or add the client to the system CLASSPATH.

To add the Easysoft JDBC-ODBC Bridge client:

  1. Choose File>Explorer and then choose the Runtime tab: Forte Explorer Runtime tab with the Drivers tree expanded
  2. Right-click on Drivers.

    Note You need to install the NetBeans Database Explorer module to add the Runtime > Databases > Drivers tab.

  3. Choose Add driver.

    The Add JDBC Driver dialog box is displayed, enabling a new driver to be added.

    Complete the dialog box 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 JDBC URL template for the JDBC-ODBC Bridge. 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 the Getting Started Guide.

    Add JDBC Driver dialog box
  4. Choose OK to add the new driver to the list: The Easysoft JDBC-ODBC Bridge now displays in the Drivers list in the Runtime tab

    Easysoft JDBC-ODBC Bridge should appear in the list of drivers.

  5. Drivers can be removed manually by selecting them in Forte Explorer and choosing Delete. You can open the driver's property sheet and modify its 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's working until a connection is made using the driver.

To test a driver:

  1. Right-click on the driver or connection in Forte Explorer and choose Test Driver from the context menu.
  2. Enter the connection information (database URL, user name, and password) when prompted and choose OK.
  3. If you get "unsupported exception," 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.) Forte returns "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:

Then enter the following:

  1. The correct driver name in Driver.
  2. The JDBC URL for the database connection in Database URL. New Database Connection dialog box with jdbc:easysoft://hanna/northwind as the 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 the Getting Started Guide.

  3. A User Name and Password if required by your database configuration.

    Choose Remember password during this session to have the IDE remember your password.

    Note The password is only 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 for each connected database in the Explorer.

  4. Choose OK to connect Forte for Java to the database.
  5. If the connection is successful, a new node appears on the same level as Drivers. The icon for a connected database shows complete: northwind database in the Databases list in the Forte Explorer Runtime tab

    If the connection attempt fails, Forte for Java displays a dialog box indicating the connection is broken.

  6. By expanding the nodes underneath the new database connection, you can access nodes for tables, views, and procedures: Right-click the Categories table, then click View Data to display the table data
  7. Right-click to choose View Data from the pop-up menu displays the result of a query showing the data in the table: Command Editor displaying the results of a select Description, Picture from Categories query

To correct the connection:

To disconnect from the database connection: