in reply to no database driver specified and DBI_DSN env var not set at

There is a difference between the strings

'"dbi:Oracle:host=localhost;sid=nms"'
and
"dbi:Oracle:host=localhost;sid=nms"

Print them both out to see it. You want the latter.

Where did you pick up the following code to build your DSN and connect to the DB? It's wrong:

# totally wrong code my $dsn = "@array[0], '@array[1]', '@array[2]'"; my $dbh = DBI->connect($dsn);

You don't want to pass a single string to DBI->connect, and the string you used is so horribly wrong in many ways it makes my head hurt. Try print $dsn; to see what $dsn contains. You want the following instead:

my $dbh = DBI->connect(@array);

... and you sure want a better name than @array for the connect parameters. Like, @connect_parameters, for example.

Replies are listed 'Best First'.
Re^2: no database driver specified and DBI_DSN env var not set at
by Anonymous Monk on Aug 08, 2007 at 14:38 UTC
    print $dsn;

    returns
    "dbi:Oracle:host=localhost;sid=nms", 'user', 'password'
    which is the results I expected.
    As for being horribly wrong... OK? But could you explain?

      You need to learn about the difference between a list and a string that looks like a list when printed. Maybe perldata helps you.

      You need to pass a list to DBI->connect(), and not a string that looks like a list when printed. Also, the DSN is not supposed to have quotes in it.

        Sorry... It makes perfect sense now! I must need more coffee this morning.

        Thanks for your patience.