[freetds] issues connecting with perl DBD::ODBC

Michael Higgins linux at evolone.org
Tue Jun 23 11:32:32 EDT 2009


On Tue, 23 Jun 2009 11:03:10 -0400
"Kulik, Scott" <SKulik at severstalna.com> wrote:

> Anyone have any luck getting connected to a SQL server database with
> DBD::ODBC in perl?  I'm hoping to try to get this issue fixed this
> week but I'm out of ideas.

Ah, joy. Just re-joined the list. Glad to see things are much the same. ;-)

DBD::ODBC connection is totally possible and entirely opaque by complexity. 

Here are my configs for you to compare.

/etc/freetds.conf
# A typical Microsoft SQL Server 2000 configuration
[TREX]
	host = localhost
#	port =1799 
	tds version = 7.0
	dump file = /home/mykhyggz/Desktop/freetds.log 

/etc/unixODBC/odbc.ini
[ODBC Data Sources]
TREX = Microsoft SQL Server 2000 

[ODBC]
Trace = yes
TraceFile	= /home/mykhyggz/Desktop/odbc.log 

[TREX]
Driver          = /usr/lib/libtdsodbc.so
Description     = TREX Data
Trace           = Yes
TraceFile	= /home/mykhyggz/Desktop/trex.log 
Server          = 127.0.0.1
Trusted Connection = no 
Port		= 1799 
Database        = TREX 
TDS_Version     = 7.0 

[Default]
Driver          = /usr/lib/libtdsodbc.so 


/etc/unixODBC/odbcinst.ini
[Default]
Driver		= /usr/lib/libtdsodbc.so

[FreeTDS]
Description		= v0.63 with protocol v7.0
Driver		= /usr/lib/libtdsodbc.so
;Setup 	= /usr/lib/libtdsS.so
;UsageCount		= 2
	
And a working connect string:

my $DSN="Driver=FreeTDS;Server=localhost;ServerName=TREX;Port=1799;Database=TREX;UID=_user;PWD=_pass";
my $dbh = DBI->connect("dbi:ODBC:$DSN",'_user','_pass');

Probably there is something about having the Driver= line in there. Note I have an SSH tunnel from my machine on port 1799 through another linux box to the server.

HTH.

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the FreeTDS mailing list