I added to odbcinst.ini
the following:
[ODBC]
Trace = yes
TraceFile = /777path/odbctrace.txt
This produces the file indicated; however, it seems to be tracking only one particular connection out of the multiple connections there are: connecting via DBI
in a pl/perl
function inside a PostgreSQL database (which is accessed directly, not via ODBC.) But I don't see much difference in how they are connecting via ODBC. The pl/perl
function (the only thing appearing in the trace file) connects like this:
my $pfdbh = DBI->connect("dbi:ODBC:$odbc",...);
if ($pfdbh) {
$pfdbh->{LongTruncOk} = 1;
$pfdbh->{LongReadLen} = 1048576;
$pfdbh->{AutoCommit} = 0; # legacy, don't ask
$pfdbh->{RaiseError} = 1;
$pfdbh->{ReadOnly} = 0;
...whereas the other perl
scripts (none of which appear in the trace file) connect like this:
my $fbodbh = DBI->connect("dbi:ODBC:$odbc",...) or die "Could not connect to $db database: $DBI::errstr";
$fbodbh->{LongTruncOk} = 1;
$fbodbh->{LongReadLen} = 1048576;
I don't see how AutoCommit, RaiseError, or ReadOnly ought to change whether a trace gets put in the log...
NEW UPDATE They don't, it seems: I made the perl
scripts connect the exact same way, and still no trace. Why could it be that a pl/perl
script would leave a trace and a regular script wouldn't?
NEW UPDATE 2 The last update I just copied the other attributes. This time, I actually call the exact same function of the exact same Perl module that does the connecting. Now it traces...so I'm really confused as to how I could be blocking the ODBC driver from being able to trace, when my code connects just fine and retrieves data, and, AFAICS, connects with exactly the same parameters and settings.