OK, I got this working. 

I needed to change the Driver line in the .ini file to:
Driver=/opt/freetds-0.91-x86_64/lib/libtdsodbc.so




________________________________
 From: Alex Zamanian <[email protected]>
To: "[email protected]" <[email protected]> 
Sent: Monday, July 22, 2013 9:28 PM
Subject: [soci-users] "Data source name not found" from C++ SOCI code, but 
works elsewhere
 


I successfully set up a DSN to a SQLServer database creating the following .ini 
file:
--
[test9]
Driver=FreeTDS
Description=Please work
Server=XXXX
Port=1433
Database=XXXX
--
and running "/opt/unixODBC-2.3.1-x86_64/bin/odbcinst -i -s -f" on it.

The reason I say it was successful, was because after some fiddling (setting 
the environment variable TDSVER to 8.0 and setting my PATH to include 
/opt/unixODBC-2.3.1-x86_64/bin:/opt/freetds-0.91-x86_64/bin), I was able to 
connect to the database using isql:
/opt/unixODBC-2.3.1-x86_64/bin/isql -v test9 usr pass

But in my C++ code:

session sql(soci::odbc, "DSN=test9;UID=usr;PWD=pass");


throws an odc_soci_error exception:

ODBC Error Code: IM002
Native Error Code: 0
SOCI Message: Error Connecting to database
ODBC Message: [unixODBC][Driver Manager]Data source name not found, and no 
default driver specified


The environment when running the C++ application appears to be same as when I 
run isql (same PATH, TDSVER, and running "odbcinst -q -s" from within the 
program lists test9 as a valid DSN).  

I'm new to all this, any help in what's going on or how to debug this further 
is much appreciated.

Thanks,
Frank

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to