Re: FreeTDS, unixODBC, GENTOO and DBD::ODBC

2009-06-03 Thread Martin Evans
col wrote:
 [x-posted to unixODBC list]
 
 Is not possible in this combination since many version updates now.
 
 I'd like to get current AND with a working configuration.
 
 Working tunnel:  ssh u...@the.pub.ip.add -q -f -N -L 1799:192.168.243.140:1433
 (Yes, tsql works, no problems with the tunnel.)
 
 Very simple perl script:
 
 my $DSN=Server=127.0.0.1;Port=1799;Database=THEDB;UID=THEUSER;PWD=THEPWD;
 
 my $dbh = DBI-connect(dbi:ODBC:$DSN,'THEUSER','THEPWD');
 
 (And that's it. 'localhost' in the DSN makes no difference.)
 
 strace ends like:
 
 open(/usr/lib/gconv/CP1252.so, O_RDONLY) = 4
 read(4, 
 \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\3\0\0004\0\0\0\320..., 
 512) = 512
 fstat64(4, {st_mode=S_IFREG|0755, st_size=9400, ...}) = 0
 mmap2(NULL, 12316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 
 0xb7b3d000
 mmap2(0xb7b3f000, 8192, PROT_READ|PROT_WRITE, 
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1) = 0xb7b3f000
 close(4)= 0
 mprotect(0xb7b3f000, 4096, PROT_READ)   = 0
 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
 +++ killed by SIGSEGV +++
 
 Following this guide:
 
 http://www.freetds.org/userguide/odbcinionly.htm
 An ODBC-only configuration relies solely on odbc.ini for server properties.
 
 [This is what is expected, then, right?]
 
 Checking with this:
 
 strace perl odbctest.pl 21 |grep odbc
 
 execve(/usr/bin/perl, [perl, odbctest.pl], [/* 47 vars */]) = 0
 open(odbctest.pl, O_RDONLY|O_LARGEFILE) = 3
 open(/usr/lib/libodbc.so.1, O_RDONLY) = 3
 open(/etc/unixODBC/odbcinst.ini, O_RDONLY) = 3
 access(/etc/unixODBC/odbc.ini, F_OK)  = 0
 stat64(/etc/unixODBC/odbc.ini, {st_mode=S_IFREG|0644, st_size=365, ...}) = 0
 open(/etc/unixODBC/odbcinst.ini, O_RDONLY) = 3
 
 Why is it trying to open odbcinst.ini, then?
 
 Something changed with unixODBC version  2.2.11 which caused this, as 
 reverting to that old version is all that's required to get working again.
 
 Help?
 
 Cheers,
 
I see you've already posted on the unixODBC list. That list and the
freeTDS list are probably the best lists to diagnose why you get a
segmentation fault. An ODBC-only setup uses more than 1 file for
configuration. The odbcinst.ini file is used to define ODBC drivers and
the odbc.ini file defines your ODBC drivers. There is a pretty good
explanation at http://www.easysoft.com/developer/interfaces/odbc/linux.html.

As Nick said on the unixODBC list, you could help diagnose where it is
crashing by getting a unixODBC trace as that would show you what ODBC
API in the driver or driver manager it is crashing in. You can do this
by adding the following to your odbcinst.ini file:

[ODBC]
Trace   = yes
TraceFile   = /tmp/unixodbc.log

then running the perl again.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com


New development release DBD::ODBC 1.21_1

2009-06-03 Thread Martin Evans
I have uploaded a new development release of DBD::ODBC to CPAN.

This fixes the issue reported in
https://rt.cpan.org/Ticket/Display.html?id=46597 and represents a change
in the behavior for binding parameters as DBD::ODBC was not following
the DBI specification.

If you bind parameters and then also pass the parameter data into
execute, DBD::ODBC would use either the default parameter type or what
the ODBC driver described the parameter as with SQLDescribeParam instead
of the type specified in the previous bind_param call.

See the rt for an example.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com


What is a good reference for what bind_col types to use when?

2009-06-03 Thread David Nicol
trial and error brings results, but seems sub-optimal.

Specifally, I tried lots of other things before finding that
SQL_DECIMAL allows 9223372036854775807 to enter into Perl as a string
rather than as 9.blahblahblahe+18. (useing sqlite.)

Are these things driver-specific or are there sane fallbacks?  For
instance, SQL_BIGINT might have gotten mapped to SQL_DECIMAL for this
driver.