perldbi

Perl - semicolon in a password for DB connection makes app fail


Our Perl app which is compiled as exe do following:

Problem: recently admin changed password on server and new password contains ";" (semicolon) char. That make Perl app always fail on attempt to connect DB2 database. So, it looks a bit weird when shell scripts works fine, win32 app works fine, .net components works fine with new password. But only this Perl executable always fail to connect db2 db.

I made a small experiment - set the same password on our local staging environment and I see exactly the same effect - shell scripts and win32 app works fine but only Perl app fail. Then I replaced semicolon in password with "-" and now Perl app works fine (all other apps and scripts also works fine with any password values). Thus, it looks like the problem is exactly with ";" char in a password for Perl app!

Info about Perl app:

Please note: I added debug output to our Perl app and I confirm that password string passed into a call to DBI-connect is 100% valid. So, value with semicolon was correctly loaded from ini-file and seems it fail somewhere inside DBI-connect.

Just FYI: Piece of code used to connect db:

$pdbh = DBI->connect($dsn, $init::user, $init::passwd);

Error message we got:

DBI connect('Txxxx','build',...) failed: [IBM][CLI Driver] SQL30082N  Security processing failed with reason "24" ("USERNAME AND/OR PASSWORD INVALID").  SQLSTATE=08001

Questions are:

  1. Is it possible to mask semicolon char in a string value to make DBI (or DBD::DB2 ?) module connect db2 database correctly even with semicolon in a password?
  2. In a theory - what could be wrong with a string with semicolon inside a function like DBI-connect(...) ?
  3. What other characters in a string value could cause problems when calling Perl functions?

Solution

  • The DB2 docs say that you can't have a semicolon in a DB2 password.

    I'm not a DB2 user, but from what I've read it seems the literal ; is reserved for the connection string format. Everything after the semicolon are various connection settings. This means that your password is effectively truncated.