. . "2016-09-14T12:28:33Z" . . . . . . "152a064c08f798f74ab48ec998651355" . "2016-09-14T12:28:33.859693"^^ . . . "2016-09-14T12:28:33.859693"^^ . . . "IODBCPerlHOWTO" . "IODBCPerlHOWTO" . . . "IODBCPerlHOWTO" . . . . . . "---+ iODBC+Perl HOWTO\r\n\r\nTim Haynes, OpenLink Software, Tue Mar 23 17:51:50 2004\r\n\r\n\r\n%TOC%\r\n\r\n---++Introduction\r\n\r\nThe following is a HOWTO document for installing Perl modules with the\r\nOpenLink iODBC SDK or iODBC Driver Manager as an Apache module on\r\nLinux/Unix systems. Feel free to criticize, suggest modifications, or ask\r\nfurther questions. It is currently being maintained by\r\niodbc@openlinksw.com.\r\n\r\nPrerequisite: Basic Unix, Linux or MacOS X familiarity (creating\r\ndirectories and users, using an editor, etc). Knowledge of how Perl modules\r\nwork is useful.\r\n\r\n---++ODBC client download and installation\r\n\r\nThis installation will provide the iODBC Driver Manager, header files, and\r\nexample program without source code. Additional ODBC driver download is\r\nnecessary.\r\n\r\nFor the latest version, visit the following OpenLink Software download pages and choose your download based on your client operating system:\r\n\r\n * SDK download page \r\n * Multi-Tier ODBC Client download page (choose only Client option to download); see footnote 1. \r\n * or Single-Tier driver download page\r\n\r\nThe SDK includes the header files required for compilation. The second\r\ndownload is only required if you have not already installed a third party\r\ndriver to connect to your database. (See also footnote 2.)\r\n\r\nb. Create a new Openlink directory, such as /usr/openlink\r\n\r\nc. Copy the \"install.sh\" file and the ODBC SDK .taz archive(s) into\r\n/usr/ openlink\r\n\r\nd. Navigate to that directory, and run:\r\n\r\n\r\nsh install.sh\r\n\r\n\r\nThis will extract the software, creating lib/ (for the driver) and include/ (for the compilation) directories under /usr/openlink/odbcsdk\r\n\r\ne. (Optional) Copy your Single-Tier or Multi-Tier ODBC Client .taz file and\r\nthe install.sh into the /usr/openlink/odbcsdk directory, navigate to that\r\ndirectory, and subsequently run:\r\n\r\n\r\nsh install.sh\r\n\r\n\r\nf. (Optional) For the Multi-Tier server side download, visit the OpenLink\r\nSoftware Multi-Tier download page and choose your download based on your\r\nserver operating system.\r\n\r\ng. Unzip the archive and perform an installation (see\r\nhttp://docs.openlinksw.com/mt/ for more).\r\n\r\nh. Make sure the OpenLink Request Broker (oplrqb) is started.\r\n\r\n\r\n---++ iODBC Driver Manager Source and SDK\r\n\r\nThe iODBC Driver Manager is recommended for programmers or those with\r\nexperience with non-OpenLink drivers. Following these steps will perform a\r\ngeneric installation of the driver manager onto your system. The files are\r\ninstalled under /usr/local, unless you specify otherwise with a different\r\n--prefix directive at configure-time. It is also recommended that you refer\r\nto the README and INSTALL files prior to proceeding.\r\n\r\na. From [[http:/www.iodbc.org/]], download the appropriate component (for\r\nthe Driver Manager)\r\n\r\nb. Extract the archive using the following command:\r\n\r\n\r\ngzip -dc < file.taz| tar -xvf -\r\n\r\n\r\nwhere file.taz is the file you downloaded.\r\n\r\nc. Move to the source directory which was just created from the extraction\r\n\r\nd. Execute the following commands:\r\n\r\n\r\n./configure\r\nmake\r\nmake check\r\nmake install\r\n\r\n\r\n---++ Creating and Testing an ODBC DSN\r\n\r\nYou need to create an ODBC DSN (data source). This will exist in your\r\nclient-side odbc.ini file, and can be done in one of two ways:\r\n\r\n\r\n---+++Manual mode\r\n\r\nYou can also review the instructions at the \"OpenLink iODBC SDK for Unix\"\r\nlink from the Client Components Installation section of the Multi-Tier\r\nRelease 4.0 documentation. A sample odbc.ini file can be found in the doc\r\nsubdirectory from your OpenLink iODBC SDK installation. To begin: a. Set\r\nand export the ODBCINI environment variable (this assumes you have not\r\nmoved that file to another directory):\r\n\r\n\r\n\r\nexport ODBCINI=/usr/openlink/odbcsdk/doc/odbc.ini\r\n\r\n\r\nor\r\n\r\n\r\nsetenv ODBCINIT /usr/openlink/odbcsdk/doc/odbc.ini\r\n\r\n\r\ndepending on your shell.\r\n\r\n---++++Create your DSN\r\n\r\nFor example, to connect to an MS Access database on Windows, you can create a\r\n[dsn_access] section, change the Host, ServerType, Database, Username and\r\nPassword entries to match your server settings. Here is part of the\r\nodbc.ini file:\r\n\r\n\r\n\r\n[dsn_access]\r\nDriver = /usr/openlink/odbcsdk/lib/oplodbc.so.1\r\nHost =\r\nServerType = Odbc\r\nDatabase =\r\nUserName = sa\r\nPassword =\r\n;FetchBufferSize = 30\r\n\r\n\r\nwhere Host is the machine hosting your MS Access database, and Database the\r\nis the name of the MS Access driver DSN you set up in the Windows ODBC\r\ncontrol panel.\r\n\r\n---++++ Run \"iodbctest\"\r\n\r\n\r\ncd /usr/openlink/odbcsdk/examples\r\n./iodbctest\r\n\r\n\r\nd. At the prompt, type a valid connect string, such as `DSN=dsn_access'\r\n(from above example)\r\n\r\ne. Once you get a prompt, you are connected and can execute any valid SQL\r\nagainst your database, or `tables' to obtain a list of tables in that\r\ndatabase.\r\n\r\n\r\n---+++Graphical mode\r\n\r\nYou can configure data sources by using the Admin Assistant HTML wizards\r\n(accessible once the Request Broker is started on the client). (See\r\nfootnote 3.)\r\n\r\n1. Ensure that your openlink.sh file has been sourced in the current shell.\r\n\r\n2. Start the Request Broker:\r\n\r\n\r\ncd /usr/openlink/bin\r\n./oplrqb\r\n\r\n\r\nc. Navigate to http://localhost:8000/ on the client machine.\r\n\r\nd. In \"Client Components Administration\", proceed to configure an ODBC Data\r\nSource and test.\r\n\r\n\r\n---++ FreeBSD-specific Concerns\r\n\r\nOn FreeBSD, it has been found to help if perl is compiled with threading;\r\nto do this, you need to build it from the lang/perl58/ port, and define\r\nWITH_THREADS (e.g. in /etc/make.conf).\r\n\r\n\r\n---++ MacOS X-specific Concerns\r\n\r\nOn MacOS X, you have the option to compile libraries either as traditional\r\nunix-like shared libraries, or as a `framework'. On OS X, the latter is\r\ngenerally preferred - for example, iODBC is built as a framework, most of\r\nthe Perl modules are, etc.\r\n\r\nThe instructions below for DBI apply regardless; however, for DBD::ODBC you\r\nhave a choice of one or other method.\r\n\r\n\r\n---++ Compiling the Perl Modules for ODBC support\r\n\r\nPerl's DBI is a generic database interface module for Perl; DBD is a range of\r\nspecific database interfaces, DBD::Pg, DBD::Sybase, DBD::Oracle, DBD::ODBC, etc,\r\nloaded by DBI.\r\n\r\n---+++ DBI\r\n\r\nDownload the DBI module from CPAN - this is frequently provided as a\r\npackage with your operating system; alternatively, you can download it from\r\nCPAN (http:/search.cpan.org) under the \"Database Interfaces\" category.\r\n\r\nAssuming you have a working Perl installation already installed on your\r\nsystem, we recommend the following method - using Perl's CPAN module - to\r\nautomate the whole process:\r\n\r\n\r\n\r\nbash# perl -MCPAN -e shell\r\ncpan>\r\nCPAN: Storable loaded ok\r\nGoing to read /root/.cpan/Metadata\r\nDatabase was generated on Wed, 02 Oct 2002 18:22:45 GMT\r\nCPAN: LWP::UserAgent loaded ok\r\nFetching with LWP:\r\n[snip]\r\ncpan> install DBI\r\nDBI is up to date.\r\n\r\n\r\nMore documentation on this method is to be found at\r\nhttp:/www.perldoc.com/perl5.6/pod/perlmodinstall.html .\r\n\r\n\r\n---+++ DBD::ODBC\r\n\r\nDownload the DBD::ODBC module from CPAN. You can either\r\ndownload it by hand from http:/www.perl.com/CPAN-local/modules/index.html,\r\nor use the following to obtain it - note that we only recommend getting it\r\nthis way rather than attempting a full install, as some intervention is\r\nnecessary to configure and compile it:\r\n\r\n\r\n\r\nbash# perl -MCPAN -e shell\r\ncpan>\r\nCPAN: Storable loaded ok\r\nGoing to read /root/.cpan/Metadata\r\nDatabase was generated on Wed, 02 Oct 2002 18:22:45 GMT |\r\n[snip]\r\ncpan> get DBD::ODBC\r\nRunning get for module DBD::ODBC\r\nCPAN: Digest::MD5 loaded ok\r\nChecksum for\r\n/root/.cpan/sources/authors/id/J/JU/JURL/DBD-ODBC-0.45.tar.gz ok\r\nScanning cache /root/.cpan/build for sizes\r\nDBD-ODBC-0.45/\r\nDBD-ODBC-0.45/Changes\r\nDBD-ODBC-0.45/dbdimp.c\r\nDBD-ODBC-0.45/dbdimp.h\r\nDBD-ODBC-0.45/fixup_c.h\r\nDBD-ODBC-0.45/fixup_t.h\r\nDBD-ODBC-0.45/Makefile.PL\r\nDBD-ODBC-0.45/MANIFEST\r\n(and so on.)\r\n\r\n\r\nNow enter the build directory (cd /root/.cpan/build/ DBD-ODBC-0.45 above), and run:\r\n\r\n\r\nbash# env ODBCHOME=/opt/openlink/odbcsdk perl Makefile.PL\r\nConfiguring DBD::ODBC ...\r\n\r\n>>>Remember to actually *READ* the README file!\r\nAnd re-read it if you have any problems.\r\n\r\nUsing DBI 1.30 installed in /usr/lib/perl5/auto/DBI\r\nUsing ODBC in /opt/openlink/odbcsdk\r\n\r\nUmm, this looks like a iodbc type of driver manager.\r\n\r\nWe expect to find the isql.h, isqlext.h and iodbc.h files (which were\r\nsupplied with iODBC) in $ODBCHOME/include directory alongside the\r\n/opt/openlink/odbcsdk/lib/libiodbc.a /opt/openlink/odbcsdk/lib/libiodbc.so\r\nlibrary.\r\n\r\nUsing DBI 1.30 installed in /usr/lib/perl5/auto/DBI\r\nWriting Makefile for DBD::ODBC\r\n\r\n\r\nThis tells this particular compilation of DBD::ODBC to use the iODBC\r\ninstallation in the openlink odbcsdk distribution. To perform the actual\r\nbuild, simply type `make'.\r\n\r\nNote: There is a bug in some versions of DBD::ODBC's Makefile.PL whereby\r\nthe generated Makefile is invalid - typically you get an error such as\r\n\r\n\r\n\r\nMakefile:313: *** missing separator. Stop.\r\n\r\n\r\nYou can simply comment-out the offending line, thus:\r\n\r\n\r\n\r\nconfig :: $(changes_pm)\r\n# @$(NOOP)\r\n\r\n\r\nAlternatively, replacing the leading spaces with a TAB character will also fix it.\r\n\r\n\r\n---++++ MacOSX-specific note\r\n\r\nInstead of typing `make' above, if you wish to build this module as a\r\nframework instead of a shared library, you will have to edit the generated\r\nMakefile; you still use the same `perl Makefile.PL -o /path/to/iodbc'\r\ncommand to generate the Makefile (it will fail if it can't find the lib/\r\ndirectory, and fail to compile if it can't find the headers to include),\r\nbut the references to `-liodbc' should become `-framework iODBC'\r\nthroughout, and the `-L'(path to iodbc/lib) should be removed, thus:\r\n\r\n\r\n\r\nVERSION_FROM = ODBC.pm\r\nINC = -I. -I/Library/Perl/darwin/auto/DBI\r\nDEFINE = -I/Users/openlink/tim/iodbc-shared/include\r\nOBJECT = $(O_FILES)\r\n\r\n\r\n\r\n# DBD::ODBC might depend on some other libraries:\r\n# See ExtUtils::Liblist for details\r\n#\r\nEXTRALIBS = -framework iODBC\r\nLDLOADLIBS = -framework iODBC\r\nBSLOADLIBS =\r\nLD_RUN_PATH = # /Users/openlink/tim/iodbc-shared/lib\r\n\r\n\r\n---++++Testing DBD::ODBC\r\n\r\nYou should also run through the tests - assign values to these variables:\r\n\r\n\r\nThe DBD::ODBC tests will use these values for the database connection:\r\nDBI_DSN=e.g. dbi:ODBC:demo\r\nDBI_USER=\r\nDBI_PASS=\r\n\r\n\r\nand execute `make test'. Optionally, for maximum verbosity, use\r\n\r\n\r\nmake test TEST_VERBOSE=1\r\n\r\n\r\ninstead. \r\n\r\n\r\n---++++Installation \r\n\r\nFinally, become root if you were not already, using su or sudo or\r\nequivalent, and type\r\n\r\n\r\nmake install\r\n\r\n\r\nto install DBD::ODBC into your perl tree. A short sample perl script using\r\nDBD::ODBC might be the following:\r\n\r\n\r\n\r\nbash# cat > dbitest.pl\r\n#!/usr/bin/perl\r\n\r\nuse DBI;\r\nuse DBD::ODBC;\r\n\r\n$|=1;\r\n\r\nmap {\r\nprint \"Data sources for $_: \" . join(\"\r\n\", DBI->data_sources($_)). \"\r\n\"\r\n}\r\ngrep(!/ADO|template/, DBI->available_drivers);\r\n\r\n\r\nwhich, when you run it, lists all data-sources for all the installed DBD::\r\ndrivers, now including ODBC:\r\n\r\n\r\n\r\nbash# perl ./dbitest.pl\r\nData sources for CSV:\r\nDBI:CSV:f_dir=mytest\r\nDBI:CSV:f_dir=t\r\nDBI:CSV:f_dir=blib\r\nData sources for ODBC:\r\nDBI:ODBC:DB2v7.x(linux)\r\nDBI:ODBC:DB2v7.x(aix32bit)\r\nDBI:ODBC:DB2v7.x(solaris)\r\n\r\n\r\n\r\n---++ Footnotes\r\n\r\n 1. OpenLink Multi-tier drivers involve installation on both the client- \r\nand server-sides.%BR%%BR%\r\n 2. A known bug was discovered when using certain versions of the OpenLink \r\niODBC SDK coupled with Perl DBD, whereby a disconnect in the Perl script \r\nwould cause a core dump. The bug did not prove to affect script functionality; \r\nit was driver-specific. The problem has been addressed in the latest ODBC SDK \r\navailable at OpenLink Software's web site (see the iODBC SDK option). For this \r\nreason, unless you are using non-OpenLink drivers to connect in your scripts, \r\nit is recommended that you install the OpenLink iODBC SDK option for your \r\nODBC home.%BR%%BR%\r\n 3. If you configure a DSN using the Admin Assistant, you'll have to copy \r\nthe modified odbc.ini file into either the home directory (or \" ~/.\") of \r\nthe Perl account, or export ODBCINI to point at it, for it to be recognized \r\nat run-time.%BR%%BR%\r\n\r\n\r\n---++ Glossary\r\n\r\n * *Admin Assistant* - the Admin Assistant is an HTML-based interface which\r\nsimplifies the process of configuring text-based configuration files used\r\nin the OpenLink Multi-Tier data architecture. It is made available via the\r\nOpenLink Request Broker, which is available for download for your Unix/\r\nLinux client from the OpenLink Multi-Tier download page. Since the Request\r\nBroker is a server component, you obtain it by specifying your server\r\nplatform as your Unix/ Linux client. Once downloaded, you can install the\r\narchive into your ODBC home directory. It will be installed as the file\r\n\"oplrqb\" in a bin subdirectory. More information can be found at the link\r\n\"ODBC Client Components for Unix\" (Wizards-Based Data Source Management) in\r\nthe OpenLink Multi-Tier Release 4.0 documentation.\r\n\r\n * *Database Agent* - an OpenLink Database Agent is an executable process\r\nwhich initiates a connection to the specified database (in the ServerType\r\nodbc.ini parameter). For ServerTypes of \"Odbc\", it acts as a generic agent,\r\nacting as a proxy to the actual database driver which will complete the\r\nconnection on the server.\r\n\r\n * *ODBC home directory* - this is the directory to which you have installed\r\neither the iODBC driver manager or the OpenLink iODBC SDK. It will contain\r\ndirectories like include and lib directly under it.\r\n\r\n * *Request Broker* - the OpenLink Request Broker is a server daemon which\r\nlistens on a specified TCP port (default of 5000) and broadcasts on a UDP\r\nport. It acts exactly as its name suggests, \"brokering\" out incoming\r\nconnection requests to the appropriate Database Agent process. The Request\r\nBroker implicitly starts another server daemon called \"www_sv\" which acts\r\nas a stand-alone web server providing easy configuration for initialization\r\nfiles.\r\n\r\n" . . . "2016-09-14T12:28:33Z" .