By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,051 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

Perl DBD DB2

P: n/a
I'm attempting to connect to a DB2 database using perl DBD::DB2. I'm
consistently getting the following error:

[IBM][CLI Driver] SQL1042C An unexpected system error occurred.
SQLSTATE=58004

What I have done:

Installed the DB2 client, registered the database and verified
connectivity using the db2 command line utility.

Verified the database with the following command:
my @data_sources = DBI->data_sources('DB2');
print "Data sources:\n\t", join("\n\t",@data_sources),"\n\n";

Data sources:
dbi:DB2:SBLDV1

Connect code:

$dbh = DBI->connect("dbi:DB2:SBLDV1", "sbldv1", "password") or
die "Can't connect to database: $DBI::errstr\n";

Output:

DBI connect('SBLDV1','sbldv1',...) failed: [IBM][CLI Driver] SQL1042C
An unexpected system error occurred. SQLSTATE=58004
at ./db2.pl line 28
Can't connect to database: [IBM][CLI Driver] SQL1042C An unexpected
system error occurred. SQLSTATE=58004

I'm at a loss as to how to move foward. All of the posts I've seen are
solved by either installing the client or registering the database -
both of which I've done.

Sep 6 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What platform is the DB2 Server on and what platform are you using the
client on? If the client is on Windows, please ensure that the system
variables are correctly pointing to DB2.

Evie wrote:
I'm attempting to connect to a DB2 database using perl DBD::DB2. I'm
consistently getting the following error:

[IBM][CLI Driver] SQL1042C An unexpected system error occurred.
SQLSTATE=58004

What I have done:

Installed the DB2 client, registered the database and verified
connectivity using the db2 command line utility.

Verified the database with the following command:
my @data_sources = DBI->data_sources('DB2');
print "Data sources:\n\t", join("\n\t",@data_sources),"\n\n";

Data sources:
dbi:DB2:SBLDV1

Connect code:

$dbh = DBI->connect("dbi:DB2:SBLDV1", "sbldv1", "password") or
die "Can't connect to database: $DBI::errstr\n";

Output:

DBI connect('SBLDV1','sbldv1',...) failed: [IBM][CLI Driver] SQL1042C
An unexpected system error occurred. SQLSTATE=58004
at ./db2.pl line 28
Can't connect to database: [IBM][CLI Driver] SQL1042C An unexpected
system error occurred. SQLSTATE=58004

I'm at a loss as to how to move foward. All of the posts I've seen are
solved by either installing the client or registering the database -
both of which I've done.
Sep 6 '06 #2

P: n/a
Fixed it!

I had installed the regular client NOT the developer version of the
client. Perusing the log files helped with the diagnosis. I was
missing the required library files.
kf******@us.ibm.com wrote:
What platform is the DB2 Server on and what platform are you using the
client on? If the client is on Windows, please ensure that the system
variables are correctly pointing to DB2.

Evie wrote:
I'm attempting to connect to a DB2 database using perl DBD::DB2. I'm
consistently getting the following error:

[IBM][CLI Driver] SQL1042C An unexpected system error occurred.
SQLSTATE=58004

What I have done:

Installed the DB2 client, registered the database and verified
connectivity using the db2 command line utility.

Verified the database with the following command:
my @data_sources = DBI->data_sources('DB2');
print "Data sources:\n\t", join("\n\t",@data_sources),"\n\n";

Data sources:
dbi:DB2:SBLDV1

Connect code:

$dbh = DBI->connect("dbi:DB2:SBLDV1", "sbldv1", "password") or
die "Can't connect to database: $DBI::errstr\n";

Output:

DBI connect('SBLDV1','sbldv1',...) failed: [IBM][CLI Driver] SQL1042C
An unexpected system error occurred. SQLSTATE=58004
at ./db2.pl line 28
Can't connect to database: [IBM][CLI Driver] SQL1042C An unexpected
system error occurred. SQLSTATE=58004

I'm at a loss as to how to move foward. All of the posts I've seen are
solved by either installing the client or registering the database -
both of which I've done.
Sep 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.