Getting Started with ODBC Driver for 4D Server


ACI - Documentation Français English German ACI Technical Notes ACI Technical Notes, By Subject Back Previous Next

Getting Started with ODBC Driver for 4D Server

By Gerald Bailey, ACI Technical Support

Technical Note 98-37

Technical Notes for Technical Notes for 98-12-December 1998

Introduction


This technical note explains the basics of getting started with ODBC Driver for 4D Server and 4th Dimension. It covers setting up and configuring the ODBC Driver for 4D Server on Windows using the 32 bit administrator application, as well as setting up Intersolve's ODBC Data Source Administrator on the Macintosh. In addition, it lists some of the common problems encountered when using the ODBC driver or ODBC plug-in.

Installing and setting up the ODBC Driver for 4D Server


Install the ODBC Driver for 4D Server by following the instructions on page 6 of the "ODBC_Driver_for_4D_Server.pdf" product documentation. This document is in Adobe Acrobat format and can be found on both the Product Line CD as well as the Partner CD. I've found that installation proceeds easier if this document is available in printed form before you begin the installation process.

The ODBC architecture is based on applications that use one or several data sources. These data sources must be defined and qualified on the client in order to gain access to the right one. The Data Source Names (DSN) can be defined at three levels:

User DSN

File DSN

System DSN

Each level corresponds to a specific application and is used in a unique way. Be careful, because client software does not support all the configurations. For example, "MS Query" from Microsoft Office 97 only works with the File DSN.

Once the ODBC Driver is installed, you may configure a DSN (Data Source Name) for connecting to a 4D Server via Microsoft Excel, Crystal Reports, Visual Basic or any other ODBC compliant application. I recommend starting out easy and attempt to retrieve data from 4D Server using Microsoft Excel. Be sure to set up both a File DSN and a User or System DSN.

One common mistake developers make when setting up a File DSN is that they fail to click the "Advanced" button and deselect the "Verify this connection" check box. Another common problem is forgetting to modify the newly-created File DSN (as the instructions show on page 18).

Open the video.dsn file using the Notepad text editor (Notepad.exe)

The video.dsn file is located in your system folder in the "BootDrive:\Program Files\Common Files\ODBC\Data Sources" path. This file needs to be modified in order for the ODBC connection to work.

The old file contents appears as follows:

Replace the existing text

Change the line which reads DRIVER=ODBC Driver for 4D Server (32 bits) to read DSN=Data Source Name. If you don't make this change, you will get an error when you attempt to connect to the 4D Server data source.

In our example, we enter: "DSN=Video."

Save the file

You will need to save the File DSN and quit the Notepad application. Now you can begin using it.

Helpful hints


Problems that occur usually cause the display of a Simba Error. This can happen when attempting to return data, or even before then. The error is generally due to one of the following reasons:

1. The product was installed using a Demo version or you are working in demo mode.

This can be fixed by deleting both the driver and product registration files, then re-installing the software using a valid Product ID number. Under Windows NT, the driver can be found in the c:\windows\system32 directory and is called 4dodbdrv.dll. The Registration file can be found in the c:\WinNT\ACI directory and is called odbcreg.txt. If using Windows 95 or Windows 98, just change the "WinNT" in the path name to "Windows."

2. 4D Open Connections are not allowed.

The ODBC Driver for 4D Server uses a 4D Open type of connection in order to connect to the 4D Server. This means the "Allow 4D Open Connections" check box MUST be checked in the Database Properties dialog box in order to be able to connect from the ODBC Driver for 4D Server.

3. Make sure you have 4D Client Licenses available.

As with any connection to the server, you must have available client licenses.

4. Do not use a DSN name in place of an IP address.

When creating a new data source, do not use a DSN name in the Network Path field of the ODBC Driver for 4D Server Setup dialog box. Use the actual IP address of the 4D Server instead.

5. Do not use the Browse button to select your database.

At this time, it's best not to use the Browse button to select your database. Instead, type the IP address of the machine in the network path. For example: TCP/IP:100.100.100.1

Intersolve's ODBC Data Source Administrator


There are few ODBC Drivers currently available for the Macintosh. This is one reason that the ODBC Driver for 4D Server only works on Windows. Of those that are available, ACI France seems to recommend the Intersolve Driver, though most should work.

If you are using the Intersolve Driver, verify that you are using version 3.0 or later of the Intersolve Driver for the Macintosh. This can be done by clicking the About tab in the ODBC Data Source Administrator control panel:


To see what drivers are available (or what type of data source you can connect to), click the ODBC Drivers tab. The default installation of the Intersolve software allows you to connect to dBase, FoxPro, Oracle, Sybase (or MS SQL Server), and text documents.

To begin creating a new DSN, click the User DSN tab and then click the Add button:

After you click the Add button, the following screen appears:

Select the driver (the data source) to which you want to connect and click the Finish button.

The following screen appears:

In this example, the data source name is "ODBC_SQLTest" and the name of the Microsoft

SQL Server is SQL_Server. The default database name is "pubs."

In the Connection tab, I used the System Administrator's Logon ID of "sa" as the default

Logon ID.

Testing the connection from 4th Dimension


To test the connection, create and execute a method in your test database such as:

   <>ODBC_ID:=OC Login dialog
   If(OK=1)
      If(<>ODBC_ID>0)
         ALERT("Connected okay...")
         OC LOGOUT(<>ODBC_ID)
         <>ODBC_ID:=0
      Else
         ALERT("Connection Failed!")
      End If
   End If

After running this method, you should get an alert that says "Connected okay...." If you do not, you should go back and check the setup of your data source using the ODBC Data Source Administrator application. In addition, you may wish to "ping" the server, using MacPing, to be sure you have a good network connection.

Summary


This technical note explains the basics of getting started with ODBC Driver for 4D Server and 4th Dimension. It covers setting up and configuring the ODBC Driver for 4D Server on Windows using the 32 bit administrator application, as well as setting up Intersolve's ODBC Data Source Administrator on the Macintosh. In addition, it lists some of the common problems encountered when using the ODBC driver or ODBC plug-in.

See Also


ODBC_Driver_for_4D_Server.pdf, ACI Product Documentation

Putting_a_Different_Face.pdf, Tim Sullivan, Automated Solutions Group


ACI - Documentation Français English German ACI Technical Notes ACI Technical Notes, By Subject Back Previous Next