Easysoft JDBC-ODBC Bridge User Guide - Configuring the Client

Configuring the Easysoft JDBC-ODBC Bridge Client

This section takes you through connecting to an ODBC data source from an existing JDBC program.

Chapter Guide

Connecting from Java

In JDBC, you connect to data sources using an URL, the format of which is dependent on the driver being used.

The format for an Easysoft JDBC-ODBC Bridge URL is:

jdbc:easysoft://hostname:port/[RemoteDSN]{:attr=value}*

where [ ] denotes an optional item and { }* denotes zero-or-more occurences.


NB

You must omit an attribute altogether (rather than passing an empty string) if you do not wish it to apply.


hostname and port describe how to access the remote machine where the JOB Server is running and should be used in the same way as in the address box of a browser, except that the additional name appletHost is supported.

appletHost is understood by the JOB Driver class and refers to the server that the applet was loaded from. For an example of using appletHost, click the Getting Started link at http://www.easysoft.com/products/data_access/jdbc_odbc_bridge/index.html and look at OutputApplet.java.

RemoteDSN identifies a System DSN (Data Source Name) configured on that machine.

The DSN should be set up with all the attributes it requires on the remote machine, with the possible exceptions of UID and PWD which can be specified on connection.

The following attributes are recognized:

:user=Database User ID

:password=Database Password

:logonuser=Remote System User ID

:logonpassword=Remote System Password

:cleartext=on or off

:limit=Row Limit

:trace=on or off

:unicode=on or off

They may also be used if the database engine requires that the connecting process (i.e. the JOB Server) is logged on via a specific user.


Caution!

Running the Windows service as a specified user (other than local admin) means that authentication must be disabled and that any user can then therefore connect, creating a security risk. You will also be unable to connect to trusted data sources (such as Microsoft SQL Server) as a system account.


The limit is actually set in the ODBC driver by the JOB Server, so it is supported only if your ODBC driver supports it.


NB

The value of Limit cannot be changed during the lifespan of a connection, so it must be set either to a value which will accommodate the largest possible result set or be omitted (which means no limit is set).


If set to off or omitted then no trace file is written. In the trace, return values, procedure calls (beginning *) and Remote Procedure Calls (beginning -->) with their return values are logged.


NB

Note that setting the trace attribute slows down performance considerably.


This setting must be specified in cases where back-end data sources support Unicode, but do not report that data conforms to the Unicode standard. The default is unicode=on, so that only columns containing Unicode data are retrieved as Unicode. Set to unicode=off to prevent any data from being retrieved as Unicode.


NB

You do not have to set up a DSN in order to make a connection. Instead, you can specify one or more connection attributes by using the attr=value clause within the Easysoft JDBC-ODBC Bridge URL.


Where to put EJOB.jar

Before you can connect your Java application to an ODBC data source, you must make the client JDBC driver (EJOB.jar) available to your application. You do this by doing either of the following:

jar xvf EJOB.jar

This will create an \easysoft directory (and subdirectories) within your application directory.

Connection difficulties

If you experience difficulties when connecting your Java applet or application to the Easysoft JDBC-ODBC Bridge, check the following:

For example:

<APPLET

ARCHIVE=EJOB.jar

CODE="OutputApplet.class"

WIDTH=250

HEIGHT=200>

<PARAM NAME = "jdbcUrl"

VALUE = "jdbc:easysoft://appletHost:8831/northwind">

</PARAM>

</APPLET>

This could be because the JDBC URL is not correct or because the driver classes are not loaded.

Try using the following syntax to resolve this:

Class.forName("easysoft.sql.jobDriver).newInstance();

Additional documentation and a connection example are provided with the Web Administrator, listening by default at port 8031.

To access this information, run a web browser and go to:

http://serverhost:8031/

where serverhost is the name of the host running the JOB Server. If the serverhost is your local machine, you can type:

http://localhost:8031/

Getting Started provides details on how to make a connection.

Tuning

Size

The size of your Java applet affects download times, which can be critical in a consumer website.

The Easysoft JDBC-ODBC Bridge driver, in its compressed .jar file, is only 64k.

You could place the .jar file into the CLASSPATH on the client machines, so that it does not need to be downloaded at all, but this small benefit in reduced size is almost certainly outweighed by the loss of zero-installation functionality.

To reduce the size of your bytecode, try compiling the application or applet with Sun's javac, rather than whatever IDE you are using. Obfuscate the classes and place them in a .jar file.

Speed

If you are returning large queries, but are only interested in the first few records, try setting the limit attribute in the connection, which reduces network traffic by restricting the maximum number of rows that can be returned in any single result-set.

Note that it is important to set the attribute to a large enough value so that no important behavior will be lost and that this feature will normally only be of use while developing your program.

To further reduce network traffic, get the DBMS to perform as much of filtering as possible.

The network is probably more of a bottleneck than CPU or I/O resources on the server, so it is better to design relatively complex queries that return a minimal result set rather than simple, naive queries that are then processed on the client side.