Feedback
Did this article resolve your question/issue?

   

Article

Configuring the PERL DBD::ODBC module to support the Connect for ODBC drivers on Unix

« Go Back

Information

 
TitleConfiguring the PERL DBD::ODBC module to support the Connect for ODBC drivers on Unix
URL Name2973
Article Number000121950
Environment
Question/Problem Description

In order to use the Connect for ODBC drivers on Unix with Perl scripts, you must modify the script that builds the DBD::ODBC module before compiling it and importing it into your Perl environment.

Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution

Here are the steps to make the DBD::ODBC module so that it will run with the DataDirect Connect for ODBC drivers on all Unix platforms:

1.  Set up environment for ODBC.

    • Source odbc.sh or odbc.csh in the ODBC install directory to add the ODBC libraries to the shared lib path
    • Set ODBCINI variable to odbc.ini file
    • Set ODBCHOME variable to the ODBC install directory(not the lib directory as specified in the DBD::ODBC documentation)
    • Set DBI_DSN variable to dbi:ODBC:data_source_name, where data_souce_name is the name of the odbc.ini data source that you plan to use.
    • Set DBI_USER variable to the database user
    • Set DBI_PASS variable to the database password

2.  Modify Makefile.PL and generate the Makefile

This file contains the following two lines by default:

$myodbc = 'intersolve'
 if !$myodbc && -f "$odbchome/include/qeodbc.h"

You need to change these lines and move them so that they are ahead of the line:

 $myodbc = 'unixodbc'

Change them to:

 $myodbc = 'intersolve'
            if -f '$odbchome/include/sqlunx.h';

If you do not move them ahead of the 'unixodbc' entry in the Makefile.PL script, then the script will think that you are using a generic Unix ODBC Driver Manager and the Makefile will not be generated correctly.


The file also contains:

   elsif ($myodbc eq 'intersolve') {
       $opts{DEFINE}  = ""
       print SQLH qq{#include <qeodbc.h>\n};
       if (-f "$odbchome/include/sql.h") {
           print "You seem to have the official header files.\n"
           $opts{INC} .= " -I$odbchome/include"
           print SQLH qq{#include <sql.h>\n#include <sqltypes.h>\n#include <sqlext.h>\n};

Change this to:

  elsif ($myodbc eq 'intersolve') {
      $opts{DEFINE}  = ""
      if (-f "$odbchome/include/sql.h") {
          print "You seem to have the official header files.\n"
          $opts{INC} .= " -I$odbchome/include"
          print SQLH qq{#include <sql.h>\n#include <sqltypes.h>\n#include <sqlext.h>\n#include <sqlucode.h>\n};

Run the command:

perl Makefile.PL

If you run into an error like 'Makefile:90: *** missing separator.  Stop.'  try setting LANG=en_US.

NOTE: Make sure the line starting with "print SQLH qq..." and ending with <sqlucode.h>\n);" is one complete line with no line breaks; otherwise there will be problems with the resulting dbdodbc.h file.

3.  Run the 'make' command to compile the DBD::ODBC module source code.

4.  Issue the command 'make test' and all tests should complete successfully. The t/02simple test threw a 'String data, Right truncated' error on a fetch, but this did not appear in the corresponding ODBC trace.

5.  Lastly, issue 'make install' to write the module to the perl directories.

After this is successful, you will be able to run all of the *.pl scripts in the mytest directory that came with the DBD::ODBC module.

Workaround
Notes
Last Modified Date9/14/2015 6:25 AM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.