Print this page.  If your browser doesn't allow JavaScript, right-click this page and choose Print from the popup-menu.        
Using Mimer SQL with iODBC on Mac OS X
Categories: ODBC, Tools and Interfaces
Introduction

As an example of connecting to a Mimer SQL database server using ODBC we will use the iODBC product, an ODBC Driver Manager. To verify the connection setup we are going to use a demonstration program delivered with iODBC called odbctest.

In this article the Mac OS X platform is used.
Description

Verify or install iODBC
The iODBC product is often installed by default on a Mac OS X system. To verify if iODBC is installed in your environment, look for the /Applications/iODBC map using Finder. There, the iODBC Administrator application should be present. Also, verify that the /Library/Frameworks/iODBC.framework, or /System/Library/Frameworks/iODBC.framework, is present. Please note, the recommendation is that the iODBC.framework is copied to /System/Library/Frameworks if not there.

If iODBC is not installed, download the Mac OS X source tarball, like libiodbc-3.52.7.tar.gz, or a prepared Mac OS X dmg package, from the Download page at www.iodbc.org. If using the source package, follow the instructions given in the README.MACOSX file within the source tree. If the dmg installation file is used, install as any other dmg file.

Install Mimer SQL
First, install Mimer SQL for Mac OS X. The software will by default end up in the /Applications directory with subdirectories like bin, lib, doc and examples under a main directory. Links to achieve a proper behavior of executables, man pages and library lookup will be made to system locations such as /usr/bin, /usr/lib and /usr/man.

You can find Mimer SQL Engine for Mac OS X on the Mimer SQL Download Page.

Create a Mimer SQL Database
As said before, Mimer SQL is by default installed under /Applications. To create a database, use the Finder application to start the Mimer SQL Database Install application found in the main directory of the Mimer SQL installation, e.g. /Applications/MimerSQL-9.2.4D.

When this application opens up, you should decide a name of your database and a password for the Mimer SQL database ident called SYSADM. This is the database user that is referred to as the System Administrator for any Mimer SQL database.

For now, you can use the default values for all other options available in the screen.



As you can see in the lower section of the screen, the option Add To ODBC Environment Setup is checked by default. This means that an ODBC Data Source definition, a System DSN, is created in the ODBC environment automatically when the Mimer SQL database server is installed. The DSN will be given the same name as the one you have chosen for the database.

Click the Create button to start the operation.

The ODBC Environment
If you want to list your ODBC definitions, make additional ones or if adjustments are needed, an ODBC Administrator is available. In the /Applications/utilities folder you find the ODBC Administrator application. Click on the icon to start the administrator.

If a Mimer SQL Database Server was installed properly you should have a Driver definition for Mimer ODBC. Click the Drivers button:



You should also have a data source defined. Click the System DSN button to get to the Data Source list:



If you want to add a Mimer ODBC Data Source manually, click the Add button in the screen shown above. Select a Mimer ODBC driver in the Drivers list and press OK. You will now get a dialog where you should give a name and description for your data source. Do that and then press the Add button in the same window. Enter the Keyword "Database" by a double-click on "Key", press the tab key and enter the name of your Mimer SQL database as Value. Please note that you must unlock the ODBC Administrator, by using the locker icon in left down corner, to be able to do any modifications.

Verify your ODBC setup
When Mimer SQL is installed properly and a Mimer SQL database server is installed and registered in the ODBC environment, open up a Terminal application window so that you get a system prompter. The Terminal application is found in /Applications/utilities. Start the odbctest program (or iodbctest and iodbctestw, for wide characters, in later versions), the iODBC Demonstration program, and use the database name for the database that you created earlier. In the following sample session the mimserver database name and the SYSADM user (with the password chosen when the database was created) are used:

# odbctest
iODBC Demonstration program
This program shows an interactive SQL processor

Enter ODBC connect string (? shows list): ?

DSN | Description
---------------------------------------------------------------
mimdb | mimersql

Enter ODBC connect string (? shows list): DSN=mimdb
Data source name [mimserver]: mimdb
Username []: sysadm
Password []:
Driver: 09.02.0003

SQL> select cast(object_name as char(25)), object_type from system.objects
where object_type = 'BASE TABLE'

|OBJECT_TYPE
-------------------------+--------------------
API_FUNCTION |BASE TABLE
AST_CODES |BASE TABLE
AST_SOURCES |BASE TABLE
CHAR_SETS |BASE TABLE
CHECK_CONSTRAINTS |BASE TABLE
COLLATE_DEFS |BASE TABLE
COLLATIONS |BASE TABLE
COLUMNS |BASE TABLE
COLUMN_OBJECT_USE |BASE TABLE
COLUMN_PRIVILEGES |BASE TABLE
DATABANKS |BASE TABLE
DOMAINS |BASE TABLE
DOMAIN_CONSTRAINTS |BASE TABLE
EXEC_STATEMENTS |BASE TABLE
FIPS_FEATURES |BASE TABLE
FIPS_SIZING |BASE TABLE
KEY_COLUMN_USAGE |BASE TABLE
LEVEL2_RESTRICT |BASE TABLE
LEVEL2_VIEWCOL |BASE TABLE
LEVEL2_VIEWRES |BASE TABLE
MANYROWS |BASE TABLE
MESSAGE |BASE TABLE
MODULES |BASE TABLE
OBJECTS |BASE TABLE
OBJECT_COLUMN_USE |BASE TABLE
OBJECT_OBJECT_USE |BASE TABLE
ONEROW |BASE TABLE
PARAMETERS |BASE TABLE
REFER_CONSTRAINTS |BASE TABLE
ROUTINES |BASE TABLE
SCHEMATA |BASE TABLE
SEQUENCES |BASE TABLE
SERVER_INFO |BASE TABLE
SEVERITY |BASE TABLE
SOURCE_DEFINITION |BASE TABLE
SPECIFIC_NAMES |BASE TABLE
SQL_CONFORMANCE |BASE TABLE
SQL_LANGUAGES |BASE TABLE
STATEMENT_DESCRIPTORS |BASE TABLE
STATEMENT_ROUTINE_USE |BASE TABLE
SYNONYMS |BASE TABLE
TABLES |BASE TABLE
TABLE_CONSTRAINTS |BASE TABLE
TABLE_PRIVILEGES |BASE TABLE
TABLE_TYPES |BASE TABLE
TRANSLATIONS |BASE TABLE
TRIGGERED_COLUMNS |BASE TABLE
TRIGGERS |BASE TABLE
TYPE_INFO |BASE TABLE
USAGE_PRIVILEGES |BASE TABLE
USERS |BASE TABLE
USER_DEF_TYPES |BASE TABLE
VIEWS |BASE TABLE

result set 1 returned 53 rows.


SQL> quit

Have a nice day.
#


Note! The error message "Dialog failed" will be received if the ODBC connect string is not given in the format "DSN=mimdb".

The Mimer ODBC Driver and the DSN is automatically installed in system wide locations, i.e /Library/ODBC. In some situations it may be necessary to define the ODBCINI environment variable to get access to these definitions:
# export ODBCINI=/Library/ODBC/odbc.ini
Links

For further details on Mimer SQL and ODBC, please see the article about the ODBC Database API.

For details on iODBC, please see www.iodbc.org.


Last updated: 2014-02-06

 

Powered by Mimer SQL

Powered by Mimer SQL