Difference: DatabaseInterfaceUpgrades (13 vs. 14)

Revision 142008-06-12 - JoeOrtagus

Line: 1 to 1
 
META TOPICPARENT name="APPX43Features"

Database Interface Upgrades

Compatibility with newer versions of popular databases is among the many features of APPX 4.3.
Line: 488 to 488
 USER DATA SOURCES..: /root/.odbc.ini [root@tubes tools]#
Changed:
<
<
Here you can see that UnixODBC is expecting the two system configuration files to be located at /etc/odbc.ini and /etc/odbcinst.ini. Now that we know the location, let's configure the files.
>
>
Here you can see that UnixODBC is expecting the two system configuration files to be located at /etc/odbc.ini and /etc/odbcinst.ini. Now that we know the location, let's configure the files. Both files can contain multiple sections or stanzas that are each identified by bracked values. Each bracked value is followed by property value definitions, one per line, in the format PROPERTY NAME=PROPERTY VALUE.
 

Configure /etc/odbc.ini

Changed:
<
<
The odbc.ini file contains a list of Data Sources and any properties for each. There are two types of odbc.ini files; 1) System and 2) User. The System odbc.ini file usually exists as /etc/odbc.ini or /usr/local/etc/odbc.ini while the user usually exist as ~/.odbc.ini. We need to build the odbc.ini file. The odbc.ini file content is driver specific (MySQL, PostgreSQL, FreeTDS, MiniSQL etc...). My file looks like this:
>
>
The odbc.ini file contains a list of Data Sources and any properties for each. There are two types of odbc.ini files; 1) System and 2) User. We will be working with the System DSN files only, and not the User DSN files. The System odbc.ini file usually exists at /etc/odbc.ini or /usr/local/etc/odbc.ini while the user usually exists at ~/.odbc.ini.

We need to build the odbc.ini file. The odbc.ini file can contain stanzas for different drivers. The content of each driver's stanza is driver specific (MySQL, PostgreSQL, FreeTDS, MiniSQL etc...). My /etc/odbc.ini file looks like this:

 
[root@tubes tools]# 

Changed:
<
<
[root@tubes tools]# cat /etc/odbc.ini
>
>
[root@tubes tools]# cat /etc/odbc.ini
 [mysql] Driver = mysql Database = appx
Line: 505 to 506
 UID = appx [root@tubes tools]#
Changed:
<
<
The Driver field is referenced in the APPX FMS settings, and in the odbcinst.ini file. The Database field is the name of the database that you want APPX to store data in. This database was created in an earlier step. The Description is informational only. The Pwd field contains the password for the MySQL user. Port is the port that MySQL is configured to listen on. The default is 3306. If it is something else, it would be listed in /etc/my.cnf. Server is the servername containing the MySQL instance we are connecting to. UID is the DSN's user account to connect to MySQL.
>
>
The [mysql] bracketed value is the Data Source Name. The Driver field is referenced in the APPX FMS settings, and in the odbcinst.ini file as a bracked value stanza header. The Database field is the name of the database that you want APPX to store data in. This database was created in an earlier step. The Description is informational only. The Pwd field contains the password for the MySQL user. Port is the port that MySQL is configured to listen on. The default is 3306. If it is something else, it would be listed in /etc/my.cnf. Server is the servername containing the MySQL instance we are connecting to. UID is the DSN's user account to connect to MySQL.
 

Configure /etc/odbcinst.ini

Changed:
<
<
This ini file simply lists all installed drivers. It is usually located in either /etc/odbcinst.ini, or /usr/local/etc/odbcinst.ini. The syntax is simple; a name followed by a property which tells us the drivers file name. For example;

[MySQL 5]
Comment = New MySQL Driver
Driver =  /usr/lib/libmysql.so.11
Setup = /usr/lib/libmysqlS.so.11
FileUsage = 1

The Driver file name ( ie /usr/lib/libsybase.so.11 ) should be unique. The friendly name ( ie MySQL 5 ) must also be unique.

The Setup property points to a shared lib containing functions to be called by ODBC Config. ODBC Config will call this share to get driver specific property names during data source configuration. If ODBC Config can not find/use this file it will assume some defaults such as; Data Source Name, Host, and default Database.

One should always modify this file either using the ODBCINST share library or by using the command line equivalent odbcinst.

>
>
This ini file simply lists all installed drivers. It is usually located in either /etc/odbcinst.ini, or /usr/local/etc/odbcinst.ini.
  We need to build the odbcinst.ini file. The odbc.ini file content is driver specific (MySQL, PostgreSQL, FreeTDS, MiniSQL etc...). My file looks like this:

Line: 532 to 519
 Description = ODBC for PostgreSQL Driver = /usr/lib/libodbcpsql.so Setup = /usr/lib/libodbcpsqlS.so
Changed:
<
<
FileUsage = 1
>
>
FileUsage = 0
  [MySQL ODBC 3.51 Driver] DRIVER = /usr/lib/libmyodbc3.so
Changed:
<
<
UsageCount = 1
>
>
UsageCount = 0
  [mysql] Description = mysql odbc connection for appx
Line: 544 to 531
 UsageCount = 1 [root@tubes tools]#
Changed:
<
<
We are only interested in the [mysql] stanza. The Description field is informational only. The Driver field is the name of the driver file that was provided by the mysql.com mysql-connector-odbc-3.51.25-0 RPM. The Description is informational only. The Pwd field contains the password for the MySQL user. Port is the port that MySQL is configured to listen on. The default is 3306. If it is something else, it would be listed in /etc/my.cnf. Server is the servername containing the MySQL instance we are connecting to. UID is the DSN's user account to connect to MySQL.
>
>
We are only interested in the [mysql] stanza. The [mysql] value matches the Driver and [mysql] bracked stanza DSN name values from the odbc.ini file. The Description field is informational only. The Driver field is the name of the driver file that was provided by the mysql.com mysql-connector-odbc-3.51.25-0 RPM. The Pwd field contains the password for the MySQL user. Port is the port that MySQL is configured to listen on. The default is 3306. If it is something else, it would be listed in /etc/my.cnf. Server is the servername containing the MySQL instance we are connecting to. UID is the DSN's user account to connect to MySQL.

The mysql-connector-odbc that we downloaded from mysql.com did not have a Setup library included, so we skipped that property. The Setup property points to a shared lib containing functions to be called by ODBC Config. By convention it usually has a capitol S towards the end of the file name such as libmyodbc3S.so. ODBC Config would call this library to get driver specific property names during data source configuration. If ODBC Config can not find or use this file it will assume some defaults.

 

Verify DSNs are working.

Changed:
<
<
We will use the isql command to make a connection to our DSN named mysql.
>
>
Now that the configuration files are in place, and the DSN is defined, let's test it out. We will use the isql command to make a connection to our DSN named mysql.
 
[root@tubes mysql-connector-odbc.from.mysql.com]# isql -v mysql

Line: 571 to 560
 SQL> quit [root@tubes mysql-connector-odbc.from.mysql.com]#
Added:
>
>
Troubleshoot isql problems.
If isql complains that it can't make a connection to the MySQL socket in /tmp/mysql.sock, then the MySQL configuration file /etc/my.cnf might be set to create the file in /var/lib/mysql/mysql.sock. You should change the my.cnf file to point to /tmp/mysql.sock, or create a symbolic link.
isql -v mysql
[08S01][unixODBC][MySQL][ODBC 3.51 Driver]Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[ISQL]ERROR: Could not SQLConnect
[root@tubes mysql-connector-odbc.from.mysql.com]# updatedb
[root@tubes mysql-connector-odbc.from.mysql.com]# locate mysql.sock
/var/lib/mysql/mysql.sock
[root@tubes mysql-connector-odbc.from.mysql.com]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
 

Set the APPX_ODBC_LIB environment variable

Added:
>
>
APPX needs to what and where the libodbc file is. libodbc is provided by unixODBC. On my system it is libodbc.so.1.0.0. For convenience, libodbc.so is a symbolic link to libodbc.so.1.0.0.
[root@tubes tools]# updatedb
[root@tubes tools]# locate libodbc.so
/usr/lib/libodbc.so
/usr/lib/libodbc.so.1
/usr/lib/libodbc.so.1.0.0
[root@tubes tools]# ls -la /usr/lib/libodbc.so*
lrwxrwxrwx 1 root root     16 Jun 11 15:37 /usr/lib/libodbc.so -> libodbc.so.1.0.0
lrwxrwxrwx 1 root root     16 Jun 11 15:37 /usr/lib/libodbc.so.1 -> libodbc.so.1.0.0
-rwxr-xr-x 1 root root 447700 Jan  7  2007 /usr/lib/libodbc.so.1.0.0
[root@tubes tools]#
The APPX environment variable APPX_ODBC_LIB can be set an many places. Where it is set is not so important just as long as it is present at the begining of the appx session. A common convention is to set it either in the /usr/local/appx/data/appx.env file, or in the service daemon file /usr/local/appx/tools/appxd-8060.env. I'm going to place it in the daemon configuration file, after verifing that it is not set in the appx.env file.
[root@tubes tools]# grep APPX_ODBC_LIB /usr/local/appx/data/appx.env
[root@tubes tools]# 
[root@tubes tools]# ./appxLoginMgr -install -SockPort=8071 APPX_KEYMAP=WINDOWS APPX_ODBC_LIB=/usr/lib/libodbc.so APPX_SS_LOG=/usr/local/appx/appx_ss_log.txt APPX_SS_CODE=0xFFFFFFFF APPX_SQL_CMD=/usr/local/appx/appx_sql_cmd.txt APPX_DBG_CODE=0xFFFFFFFF
Warning - the engine that you named has the setuid bit enabled,
          you may not want that bit set for the authentication
          method that you have chosen (OS-User)
 	   To turn off the setuid bit, chmod u-s ../appx
Configuration written to:  appxd-8071.ini
Environment written to:    appxd-8071.env
Service script written to: /etc/init.d/appxd-8071
Configuration complete
Registering service
Starting appxd-8071: serviceName: appxd-8071
servicePath: /usr/local/appx/tools/
Looking for config file in appxd-8071.ini
Warning - the engine that you named has the setuid bit enabled,
          you may not want that bit set for the authentication
          method that you have chosen (OS-User)
 	   To turn off the setuid bit, chmod u-s ../appx
Writing process ID to /var/run/appxd-8071.pid
running as process 2652 servicing port 8071

Warning - the engine that you named has the setuid bit enabled,
          you may not want that bit set for the authentication
          method that you have chosen (OS-User)
 	   To turn off the setuid bit, chmod u-s ../appx
up and running (process 2652 servicing port 8071)
Installation Complete

[root@tubes tools]# License server started as process 2657, logging to /usr/local/appx/tools/../data/license.log

[root@tubes tools]# 
The service installation completed successfully. I added some optional debug only arguments to the service that create log files. These log files can be very helpful in debugging connection failures. Remove the debug arguments though before turning the service over to production use. The arguments I used are APPX_SS_LOG=/usr/local/appx/appx_ss_log.txt APPX_SS_CODE=0xFFFFFFFF APPX_SQL_CMD=/usr/local/appx/appx_sql_cmd.txt APPX_DBG_CODE=0xFFFFFFFF.
 

Configure APPX FMS parameters.

Added:
>
>
Well, MySQL is installed, configured to work with UnixODBC. Let's make the FMS settings in APPX to wrap up.

  • In APPX, Go to System Administration, then File Management, then FMS Groups.
oracle-fms-01.jpg

  • Create an FMS group with an appropriate name, and specify type 6 for ODBC.
mysql-fms-01.jpg

  • File in the ODBC DSN name for MySQL, followed by the Table Naming Scheme in the FMS Group Attributes of your new FMS group. The Table Naming Scheme could be picked from the suggestions shown when clicking on the Hints button. Also, add any three character value to the Proxy Lock field, I used LOK.
mysql-fms-02.jpg

  • Under Identities, define at least a default identity.
mysql-fms-03.jpg

  • Enter the MySQL account to use for the Default Identity, leave Realm empty.
mysql-fms-04.jpg

  • Enter the MySQL account's password.
mysql-fms-05.jpg
 

PostgreSQL 8.1.9

IBM DB/2

Microsoft SQL-Server

Line: 612 to 680
 
META FILEATTACHMENT attachment="oracle-fms-04.jpg" attr="" comment="Specify Identity or the Oracle account to login as." date="1212700571" name="oracle-fms-04.jpg" path="oracle-fms-04.jpg" size="48630" stream="oracle-fms-04.jpg" user="Main.JoeOrtagus" version="1"
META FILEATTACHMENT attachment="oracle-fms-05.jpg" attr="" comment="Enter the Oracle user ID here." date="1212700611" name="oracle-fms-05.jpg" path="oracle-fms-05.jpg" size="47115" stream="oracle-fms-05.jpg" user="Main.JoeOrtagus" version="1"
META FILEATTACHMENT attachment="oracle-fms-06.jpg" attr="" comment="Enter the Oracle password here." date="1212700660" name="oracle-fms-06.jpg" path="oracle-fms-06.jpg" size="51280" stream="oracle-fms-06.jpg" user="Main.JoeOrtagus" version="1"
Added:
>
>
META FILEATTACHMENT attachment="mysql-fms-01.jpg" attr="" comment="Create FMS group name, and specify type 6 for ODBC." date="1213296033" name="mysql-fms-01.jpg" path="mysql-fms-01.jpg" size="55696" stream="mysql-fms-01.jpg" user="Main.JoeOrtagus" version="1"
META FILEATTACHMENT attachment="mysql-fms-05.jpg" attr="" comment="Enter the MySQL password here." date="1213296377" name="mysql-fms-05.jpg" path="mysql-fms-05.jpg" size="67830" stream="mysql-fms-05.jpg" user="Main.JoeOrtagus" version="1"
META FILEATTACHMENT attachment="mysql-fms-04.jpg" attr="" comment="Enter the MySQL user ID here." date="1213296452" name="mysql-fms-04.jpg" path="mysql-fms-04.jpg" size="63381" stream="mysql-fms-04.jpg" user="Main.JoeOrtagus" version="1"
META FILEATTACHMENT attachment="mysql-fms-03.jpg" attr="" comment="Specify a default identity for the FMS connection." date="1213296598" name="mysql-fms-03.jpg" path="mysql-fms-03.jpg" size="63847" stream="mysql-fms-03.jpg" user="Main.JoeOrtagus" version="1"
META FILEATTACHMENT attachment="mysql-fms-02.jpg" attr="" comment="Enter MySQL DSN name, Table naming scheme, and any three character value for Proxy Lock ID." date="1213296699" name="mysql-fms-02.jpg" path="mysql-fms-02.jpg" size="67603" stream="mysql-fms-02.jpg" user="Main.JoeOrtagus" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback