0
votes

I'm trying to connect to our database in our production environment. I am getting the 107 ISAM error: record is locked . I have checked various articles on what it could be, but no luck. I double checked the database details with our DBA and the information is correct.

FYI - Also the first error previous to the "record is locked" error I received was SQL: -931: Cannot locate web1_tcp service/tcp service in /etc/services. at test_db_connectivity.pl line 13. . I worked with our SA to get that entered and that is no longer appearing. Can anyone offer any guidance on the ISAM 107 error? Is my connection string wrong? There shouldn't be a lock because I am not even opening a connection to the database.

test_db_connectivity.pl:

#/usr/bin/perl -w

use DBI;
use strict;
use DBI qw(:sql_types);
use DBD::Informix qw(:ix_types);

    my $driver = "Informix";
    my $database = "web1";
    my $dsn = "DBI:$driver:dbname=$database";
    my $userid = "user";
    my $password = "password";
    print "I got this far!\n";
    my $dbh = DBI->connect($dsn, $userid, $password, {RaiseError => 1}) or      die $DBI::errstr;
    print "Opened db successfully\n";
    $dbh->disconnect();

Some of the variables set:

export INFORMIXDIR=/opt/informix

export   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools

export INFORMIXSERVER=web1

INFORMIX SQLHOSTS FILE:

#dbservername nettype hostname servicename options

web1 onsoctcp 10.199.***.* web1dev1_tcp

etc/services FILE:

web1dev1_tcp 1533/tcp # Port assigned to database

virtual-places 1533/tcp # Virtual Places Software

web1dev1_tcp 1533/udp # Port assigned to database

1
This is on a VM host. So this would be a remote connection. Is there a different format to do such? - BV45

1 Answers

1
votes

On Linux, there is a system error 107:

107 (ENOTCONN): Transport endpoint is not connected

It is hard to distinguish that from a C-ISAM error 107 (the number is the same). However, in context, I think the ENOTCONN is far more likely to be the problem than

ISAM ERROR 107: record is locked.

I observe that you're using a notation in $dsn that DBD::Informix doesn't test for:

my $dsn = "DBI:$driver:dbname=$database";

The dbname= portion of that is incorrect. You should use:

my $dsn = "DBI:$driver:$database";

Note that the DBI spec (when I last looked) said that what follows the driver name is driver-specific. You could submit an enhancement request.

However, on my working system, when I use the dbname=stores notation, the error I get is:

DBI connect('dbname=stores', '',...) failed: SQL: -354: Incorrect database or cursor name format. at dbname-dsn.pl line 8.

That's quite different. You say you got:

SQL: -931: Cannot locate web1_tcp service/tcp service in /etc/services. at test_db_connectivity.pl line 13

The error message is quite explicit. You need an entry in /etc/services such as:

web1_tcp    9088/tcp

At the moment, you do not have such an entry, and therefore the connection is not even attempted, much less successful.