I am trying to use DBI (with DBD::Informix) to connect to Informix given only an ip address and port number. In this context, I can not depend on the sql hosts file on the machine being accurate. Is what I am doing possible?
In the documentation they mention connection strings in the form of //machine1/dbase so I gave this a try:
DBI->connect("dbi:Informix://10.1.23.232:2232/eris", $user, $pass);
but received the following error:
DBI connect(‘//10.1.23.232:2232/eris’,’someuser’,…) failed: SQL: -1804: Invalid database environment. at tools/check_informix.pl line 63
What is the correct approach to connecting to an Informix server knowing only a port and ip address?
The notation using
//machine/dbaseis primarily for use with Informix Standard Engine, SE (and I believe the:portnotation would not be recognized even then; I’d have to research to find out which port is used, but it is likely 1525 or 1526). AFAIK, it does not work with Informix Dynamic Server, IDS. You need to create an entry in the sqlhosts file for a server name, which specifies the machine (raw I/P address OK) and the port (raw port number OK), such as:You would then specify the connection string as:
You can specify any file as the sqlhosts file with the INFORMIXSQLHOSTS variable. The server name you specify in the sqlhosts file must match the actual server name on the host with I/P address 10.1.23.232 that is listening on port 2232.