0

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.

Kev
  • 15,899
  • 15
  • 79
  • 112

1 Answers1

0

Its just a guess, but are the different connections running as different users?

If so it may be a permissions thing, the first connection is creating the trace file, then the other traces are failing to write to the file as its owned by the first user. Create the trace file (empty) before the run and give it rw-rw-rw permissions.

Nick Gorham
  • 1,118
  • 8
  • 9
  • Nope, all as the same user, `apache_user` (running mod_perl2.) The permissions file and all parent dirs have 777 perms. – Kev Apr 29 '14 at 21:18