Thank you monks. I have tried any possible solution (cleaning the path for Windows, setting ENV etc.), but NO solution works in the packed versions (pp). And I really do not understand why! Here is a better script that reproduces the problem (the first part works, the second no).

use warnings; use strict; use DBI; use DBD::SQLite; #Working part with hard coded path my $dbfile1="C:/users/DON/Desktop/data.db"; print "\nFIRST Connection to dbfile path read from script ($dbfile1) . +.. "; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile1","","") || die $DBI +::errstr; print "done!\n\n"; #NOT working part with path from file my $dbfile2; print "Reading dbfile path from configuration file... "; my $FileInput="config.txt";#simple txt file containing this: C:/users/ +DON/Desktop/data.db open my $FH, "<:encoding(UTF-8)", $FileInput || die (print "can't open + file $dbfile2"); while (my $line = <$FH>) { $dbfile2 = $line; chomp $dbfile2; } print "$dbfile2\n"; print "SECOND Connection with dbfile read from file $dbfile2 ... "; $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile2","","")|| die $DBI::er +rstr; print "done!\n";

Again, from the command line the script works correctly. The by pp compiled version behaves like this:

FIRST Connection to dbfile path read from script (C:/users/DON/Desktop +/data.db) ... done! Reading dbfile path from configuration file... C:/users/DON/Desktop/da +ta.db Can't connect to data source 'dbi:SQLite:dbname=C:/users/DON/Desktop/d +ata.db' because I can't work out what driver to use (it doesn't seem +to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not s +et) at script/myscript.pl line 22. SECOND Connection with dbfile read from file C:/users/DON/Desktop/data +.db ...
I

I've been stuck for days on this problem. So any help is very much appreciated


In reply to Re^2: Can't connect to data source 'DBI:SQLite:\C:\Users\DON\Desktop\data.db by IB2017
in thread pp concatenate path by IB2017

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.