ODBC Connections to Janus

by Alan Brooks

ODBC

Open Database Connectivity is a standard developed by Microsoft and Sybase that defines drivers used to connect client applications with back-end databases. The driver provides for a call-level interface at the application end, and either low-level data access or SQL translation at the other.

When an application makes a call to an ODBC driver, the driver verifies that it has received ANSI standard SQL, then translates that SQL into a language appropriate to the targetted database -- Transact SQL for Microsoft or Sybase SQL Server, low-level data access for Access, Paradox or FoxPro, etc. The latest drivers and the latest application development environments have provisions for not verifying that the input stream is ANSI standard SQL, and passing the stream directly to the target database. For instance, Visual Basic 4.0 uses a technique called SQL Pass Through implemented as the sqlPassThrough method.

There is not a single ODBC driver, rather there are different drivers for different databases, a growing number of versions of each driver, and with the increasing popularity of Windows 95, Windows NT and the latest MacIntosh operating systems, both 16-bit and 32-bit versions of the latest drivers.

Generally ODBC drivers are implemented as DLLs and the same driver will accept the same parameter string from any client development environment on the same platform. That is, they are generalized on the client-side. They are not, however, generalized on the server side. Drivers for older versions of Microsoft and Sybase SQL Server would probably work across both these databases because they were developed together, but with later versions the differences have grown and the appropriate "native" (database specific) driver must be used.

ODBC and Janus

What does this mean from a practical point of view for Janus applications? Because Janus allows Model 204 to appear as a Sybase SQL Server (or Sybase Omni Server), it means you have to communicate with Janus via either the DB-Library or CT-Library call level interface (implemented as C functions), or you have to use the native Sybase drivers supplied as part of the Sybase Open Client package, and your client development package's native or ODBC interface to those drivers.

For example, if you want to write an application using Visual Basic Version 4.0, and you want to take advantage of the 32-bit architecture of your operating system, you must take the following steps:

  1. Install the latest 32-bit Sybase Open Client. This will:
  2. Use the Sybase-provided utility SQLEDIT.EXE to configure remote servers with which you'd like to communicate.

    SQLEDIT looks like this:

    Note that for any server, there can be a variety of "Connection Service Entries". The "query" entry shown in the sample is used by Windows 95. a "win3" query is used by Windows 3.1. This is useful if your Open Client directory resides on a shared server, accessed by different types of client machines.

    SQLEDIT does nothing more than build entries in a file called SQL.INI, which is usually stored in the /ini subdirectory of your Sybase directory (e.g. c:/sql10/ini/sql.ini). If you have a large number of servers or connections to configure and they are largely duplicates of each other it is faster to just edit sql.ini with an ascii editor.

  • Use Windows 95's 32-bit ODBC setup utility to configure your target ports. (Windows 95 has a different setup utility for 16-bit and 32-bit ports, and they can't be used interchangeably).

    The ODBC setup utility does two things: It allows ODBC clients to be aware of the target port(s) and it associates the appropriate driver with the port.

    The highlighted row in the picture above shows the same server we defined as "Omni" in SQLEDIT we've called "Omni" here, and we've associated the driver "Sybase System 10" with it. Similar to SQLEDIT, the ODBC setup utility simply edits entries in a file called ODBC.INI, which you can also change manually. ODBC.INI is usually stored in the /WINDOWS directory on Windows machines.

    Here's what ODBC.INI looks like

    
    [ODBC 32 bit Data Sources]
    Omni=Sybase System 10 (32 bit)
    Sybase System 10=Sybase System 10 (32 bit)
    junk999=SQL Server (32 bit)
    Omni SQL Server=SQL Server (32 bit)
    DEMOPRO=Sybase System 10 (32 bit)
    OmniX=Sybase System 10 (32 bit)
    SYBASEX=Sybase System 10 (32 bit)
    DEMO999=SQL Server (32 bit)
    SYBASE=Sybase System 10 (32 bit)
    
    [Omni]
    Driver32=C:\WINDOWS\SYSTEM\SYSYB95.DLL
    
    [Sybase System 10]
    Driver32=C:\WINDOWS\SYSTEM\SYSYB95.DLL
    
    [ODBC Data Sources]
    Powersoft Demo DB V5 IM=Sybase SQL Anywhere 5.0
    Peat=Sybase SQL Anywhere 5.0
    inbound=Sybase SQL Anywhere 5.0
    ...
    
    
    

    That's all there is to it. Now, pointing a client ODBC call to port Omni will result in the ODBC interface executing the driver sysyb95.dll which is registered as a 32-bit driver (see, "Driver32=sysyb95.dll"). The driver has appropriate prompts built in for communication to Sybase and therefore, Janus Omni.




    {products} {support} {model 204} {calendar} {demo} {articles} {staff}

    e-mail: Sirius technical support

    The Sirius site runs as a Model 204 application using the Janus Web Server.
    This page and all contents are Copyright © 1996 by Sirius Software, Inc., Cambridge, MA.