Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Informix > Perl to Informix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-30-03, 20:23
islamabadi islamabadi is offline
Registered User
 
Join Date: Apr 2003
Posts: 20
Perl to Informix

My system admin has just installed Informix module that I am trying to connect to through Perl via Unix. Please keep in mind that I have been successful in connecting via ODBC and run the queries.

Here is my code:

#! /usr/bin/perl

use DBI;
$dbh = DBI->connect('dbi:Informix:testdb@testserver','user',' password'
,{ AutoCommit => 0, PrintError => 1 });
$dbh->disconnect;

I get the following error:

DBI connect('db_dg@gsmdg1.cig.mot.com','omcadmin',...) failed: SQL: -1829: <<Failed to locate SQL error message>

Can someone tell me what I or the system admin need to do to get this going. I saw some reference to INFORMIXDIR, INFORMIXSERVER, etc to be set. Where do these env need to be set? USer running the Perl script??

Also, a document references sqlhosts file. Where is this other than the Informix server itself, which is there and is functional.

What is different in UNIX world that I can't figure out? Help!
Reply With Quote
  #2 (permalink)  
Old 05-01-03, 19:16
DoomDog DoomDog is offline
Registered User
 
Join Date: Mar 2003
Location: Palmer, Alaska USA
Posts: 13
Re: Perl to Informix

try adding in your perl script before your DBI connect statement:

# Set Informix DB environment variables.
$ENV{INFORMIXDIR} = '/informix930';
$ENV{INFORMIXSERVER} = 'ak0779_gcdb';
$ENV{PATH} = '/informix930/bin:/bin:/usr/bin';

of course your specific paths and server name will most likely be different!

hope that it helps!
__________________
Don't take my word for it ... trial and error is my methodology (mostly error)...and then I forget and go thru it all again!
Reply With Quote
  #3 (permalink)  
Old 05-02-03, 18:04
islamabadi islamabadi is offline
Registered User
 
Join Date: Apr 2003
Posts: 20
$ENV{INFORMIXDIR} = '/informix930';
$ENV{INFORMIXSERVER} = 'ak0779_gcdb';
$ENV{PATH} = '/informix930/bin:/bin:/usr/bin';

Is this information on the server that I am connecting to. For example, is the INFORMIXDIR the INFORMIXDIR that I have on the connecting server?
Reply With Quote
  #4 (permalink)  
Old 05-05-03, 15:02
DoomDog DoomDog is offline
Registered User
 
Join Date: Mar 2003
Location: Palmer, Alaska USA
Posts: 13
It is the information for the machine you are trying to connect from, i.e., the one you are trying to run perl on.
Reply With Quote
  #5 (permalink)  
Old 05-19-03, 06:32
Emmon Emmon is offline
Registered User
 
Join Date: Nov 2002
Location: London
Posts: 47
Hi

I'm not sure which ODBC driver you're using here to connect but you'll find a step by step walkthrough on getting an ODBC connection with Perl including a script to return records at www.iodbc.org

HTH
Emmon
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On