This section takes you through connecting to an ODBC data source from an existing JDBC program.
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.
| You must omit an attribute altogether (rather than passing an empty string) if you do not wish it to apply. |
hostnameand 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.htmland 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:
:logonuser=Remote System User ID
:logonpassword=Remote System Password
| Set the ClearText attribute to true if you wish to be able to see the contents of these fields. |
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.
| 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.
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.
| 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.
| 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. |
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:
This will create an \easysoft directory (and subdirectories) within your application directory.
If you experience difficulties when connecting your Java applet or application to the Easysoft JDBC-ODBC Bridge, check the following:
VALUE = "jdbc:easysoft://appletHost:8831/northwind">
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();
For an example of connecting to the JOB from a Java applet, run a web browser and then:
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:
where serverhost is the name of the host running the JOB Server. If the serverhost is your local machine, you can type:
Getting Started provides details on how to make a connection.
Demonstration invokes an applet which can be used to connect to ODBC data sources (see The Test Applet).
Once you have an ODBC data source set up on the same machine as the JOB Server:
1. Run a browser and go to http://serverhost:8031/demo/awt_index.html
where serverhost is replaced by the name of your host.
The demonstration applet runs automatically within the Web Administrator built in to the JOB Server.
2. In Logon User and Logon PWD, enter a valid user name and password for the server machine (these may be for either the server machine itself or for a domain, if the server is on a network):

A dialog box is displayed listing the data source(s) available on the same machine as the JOB Server.
4. From the DSN drop-down list, choose the data source to which you want to connect:

5. In DB User ID and DB Password, enter the user name and password required by the back-end database (use demo and easysoft to connect to the pubs database at Easysoft).
Note that the details entered in the Logon User and Logon PWD fields on the Logon screen are displayed in the Logon and Password fields on this screen.
6. Click Connect to make the connection.
If the connection is successful, the tables in the data source are listed in a new window.

7. To execute a query on the database, either type a query into the SQL box and then click Submit.
Double-click on a table name in the list of Tables on the left-hand side of the window to retrieve up to 100 rows of that table.
| The number of tables and rows displayed is specified in the JDBC URL :limit=100 connection attribute. |
The query results are displayed in a new window:

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.
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.
| Copyright Notice |