Making a Database Connection in UltraDev 1 on Macintosh

 by Tom Muck

The Macintosh requires a connection to a Windows machine in order to access the same database features of UltraDev 1 that Windows users enjoy.  The Mac will connect using a JSP database driver, called RmiJdbc, which is a Type 3 JDBC driver for Windows NT.  It is actually just a bridge that allows you to remotely access a database through Java, and connects to the database through the Sun JDBC:ODBC Bridge.

The RmiJdbc driver comes as part of the UltraDev package, and is located in the Third Party Software folder on the UltraDev CD.  You can also download it from You will need to copy the uncompressed JAR file to a folder on the NT machine and also copy it to the Macintosh and place it in the System Folder in Extensions>MRJ Libraries>MRJClasses.

The RmiJdbc driver needs the JDK1.1.8 from Sun Microsystems installed on the Windows server to work.  If you don't already have that particular JDK installed on the machine, you can download it from the Web site and install it.  The JDK can co-exist with the newer 1.2 or 1.3 JRE, but the RmiJdbc must be run from the JDK1.1.8.  If you happen to have the 1.2 or 1.3 JRE installed already, and you have to install the JDK1.1.8 as well, take care not to set up a classpath to the older JDK.  Youíll be able to run the RmiJdbc driver directly from the JDK1.1.8, as weíll show later.

To install the RmiJdbc driver on the Windows machine, you must first copy the RmiJdbc.jar file to a directory on the server.  Then, create a new folder named "rmijdbc" and place the file in that folder.  The next step is to set the classpath for that file.  The classpath is simply a system-wide setting that Java will look at to find the classes that it needs.  Chances are there is already a classpath setting in the Windows machine, but you can append another classpath to it by doing the following:

(3)Windows NT:

1.      Go to "My Computer" and right-click, then choose Properties from the menu.

2.      Click the Environment tab in the System Properties dialogue box.

3.      If there is a Classpath variable, choose it, and if not, type in "Classpath" in the Variable textfield (Figure 1).


Figure 1: Setting the Classpath on a Windows NT machine for the RmiJdbc driver.

4.      If there are already values in there, go to the end of the string and use a semi-colon as a delimiter.  Type in the path to the RmiJdbc.jar file, in this case c:\rmijdbc\rmijdbc.jar

5.      Click the "Set" button in the dialogue box. This will set the variable for you.

6.      Restart the machine.

Windows 2000

  1. Go to "My Computer" and right-click, then choose Properties from the menu.
  2. Click on the Environmental Variables button in the Advanced tab of the System Properties dialogue.
  3. Select the classpath variable from the list of System variables if there is one, or create one if there isnít.  Add c:\rmijdbc\RmiJdbc.jar to the list of variables.
  4. Restart the machine.

Windows 95/98

  1. Find the "Autoexec.bat" file and open it up in Notepad or another text editor.
  2. Add this line to the end of the file, substituting your own path if itís different from the path that we've used: 

    set classpath="c:\rmijdbc\RmiJdbc.jar"

  3. Restart the machine.

Running the RmiJdbc driver

After successfully installing the driver and setting the appropriate Classpath, you need to run the driver from a command prompt in order for the Macintosh to be able to connect to the Windows machine.  Open up a Dos window and type the following line into the prompt, substituting the correct path on your machine to the JDK1.1.8:

c:\JDK1.1.8\bin\java RmiJdbc.RJJdbcServer sun.jdbc.odbc.JdbcOdbcDriver

If everything is configured correctly, this command should bring up a screen similar to Figure 2.  The DOS window must remain open on the Windows machine for the database connection to work, but it can be minimized. 

Figure 2: Running the RmiJdbc driver after a successful installation.

Tip: You can put the command that starts the RmiJdbc driver into a batch file and place it in the startup folder on the Windows machine to make sure that the driver is always started in the event of a system restart.  Simply copy the line into a text file and name it something like "RmiJdbc.bat" and drop it into the Startup folder.

With the RmiJdbc driver running on the Windows machine, you can now move to the Mac and create a connection to the database.  Bring up the Connections dialogue box by going to the Modify menu and choosing Connections, or going to the Data Bindings palette and clicking the plus sign (+) to bring up the Recordset dialogue box, then clicking "Define" to get to the Connections dialogue box (Figure 3).

Figure 3: The Connections dialogue box on a Macintosh.

From the Connections dialogue box you can choose New to create a new database connection.  This will bring up the dialogue box shown in Figure 3.  The Run-Time Connection tab can be an ADO Connection String, and ADO ODBC Data Source, a ColdFusion Data Source, or a JDBC connection.  Follow the instructions in one of those sections above for the Run-Time connection.  Please note that this connection has to be a valid connection on the Windows machine where the database resides.  The RmiJdbc will connect to that database for the design environment to allow you access to the database columns and also to allow you to view "Live Data" directly on the Macintosh in the design window.  The actual code that's written to the page, however, will be the correct code for the configuration of the server/database that you are using.  For example, if you were to examine the code for a ColdFusion database connection, the code would look something like this:

<cfquery name="Recordset1" Data Source="bettergig">
Select * from Users
<cfset Recordset1_NumRows = 0>
<cfset Recordset1_Index = 1>

Obviously this code means nothing to the Macintosh, yet by connecting to the Windows machine through a live connection to the RmiJdbc driver, you can view the data from the database as if you were on that machine.

The Design-Time Connection is shown in Figure 4.  You are only given one option, and that is JDBC.  This will connect you to the Windows machine through the RmiJdbc driver.  To get a working connection, follow these steps:

Figure 4: The Design-Time Connection tab on the Macintosh, filled in with the correct information for a connection to an ODBC Data Source named "bettergig".

1.        Choose the RmiJdbc driver from the Driver dropdown box.  If it doesn't appear, you can type it in this way:


2.      Fill in your Username and Password to connect to the database.

3.      For the URL, you need to use the machine name and the System DSN name for the database you are connecting to.  A possible connection URL string might look like this: 


If all of the settings are correct, when you press the "Test" button, you will see the dialogue box shown in Figure 5, signifying a successful connection.

Figure 5: A successful connection on the Macintosh brings up this dialogue.

By connecting to the Windows machine through the RmiJdbc, you are now able to work with the data connections on that Windows machine.

Tom Muck