Q) How can I get the iASP server to work with a database using an ODBC connection on a non-Windows platform?

A) iASP supports ODBC via the JDBC-ODBC bridge. In order to use ODBC, the first thing you will need is an ODBC driver manager for your platform.

Please refer to this sample file. You will need to ensure that the JDK you use includes the JDBC-ODBC bridge (NOTE: for UNIX, most version 1.1.x JDKs do not provide JDBC-ODBC bridges.). To get ODBC connectivity working follow these steps:

  1. Build and install unixODBC (an ODBC Driver Manager for Unix). You can get unixODBC source from http://genix.net/unixODBC/
  2. Build and install MyODBC (an ODBC Driver for MySQL). You can get MyODBC source from http://mysql.com/download.html
  3. Add a new ODBC Data Source (DSN) to unixODBC. unixODBC uses /etc/odbc.ini to store information about System DSNs and ~/.odbc.ini to store information about User DSNs. Below is a sample odbc.ini file that shows how to add a new DSN to the User or System DSNs. If you append this file to the ~/.odbc.ini you will have new User DSN for MySQL. If you append this file to the /etc/odbc.ini you will have new System DSN for MySQL.
  4. Finally test the DSN using the unixODBC isql tool:
    isql test mysql_user mysql_pwd

Sample ODBC.ini File

#====================================================
# odbc.ini (Unix)
#
# Copy this to ~/.odbc.ini and you can access
#
the test database with 'SAMPLES/odbctest
#
# If you are using this with iodbc, you must
#
also copy this file to the location
# where your iodbc installation are
# looking for the iodbc.ini file!
#====================================================
#
# sample configuration file for iODBC
#
#----------------------------------------------------
#
# a driver section is set up like this:
# [<identifier>]
# Driver = <path>/<name_of_dynamic_link_library>
# DSN = <database_name>
#
# <identifier> ::= [A-za-z][A-Za-z0-9_]*
# [default] ::= entry used, if no other data matches
#
# Trace = ON | On | on | 1 | OFF | Off | off | 0
# enable tracing of ODBC routines
# Tracefile = stdout | stderr
# output for trace information, either stdout or stderr
#
# Some MySQL specific options:
#
# SERVER = hostname of server that runs mysqld
# PORT = TCP/IP port (default 3306)
# SOCKET = Unix socket to use as connection
# if SERVER is not given or if
# SERVER is 'localhost'
# DATABASE= Database to connect to. If not
# given, DSN is used.
# This allows one to access databases with
# the same name on
# different machines.
# OPTIONS= Changes behavour of MyDOBC for
# not ODBC compilant clients.
# See the myodbc README file for more information.
#
#====================================================
#
# MySQL specific:
# If DB is given it's used as the databasename
# instead of DNS.
#
#

[test]
Trace = Off
TraceFile= stderr
Driver = /usr/local/mysql/lib/libmyodbc.so
DSN = test
SERVER = localhost
USER = test
PASSWORD =
PORT = 3306
#OPTIONS = 1
DATABASE = mysql
SOCKET = /tmp/mysql.sock

#====================================================
# end of file #
#====================================================


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.