Ok what I need to do is probably setup a connection using UnixODBC .... Then i can use that connection to connect to the MS SQL Server ..... which has ODBC compatibility mode enabled ...... 1) Install the two packages "odbcinst1" and "libct1" with your favourite package manager. Now you have installed UnixODBC and FreeTDS, respectively. 2) You have to tell FreeTDS about the MS SQL Server it should connect to: Edit /etc/freetds/freetds.conf (with your favourite editor) and go to the bottom of the file and copy/modify one of the entries names MyServerto get something like this: # Business Data [BData] host = 192.168.1.10 port = 1433 tds version = 8.0 where the name in square brackets, "BData", is something you have to tell ODBC about later on, the "host" line is the DNS name or the IP number (which is what I used above) of the box running MS SQL Server, "port" is default for MS SQL Server 1433 and shouldn't have to be changed unless you have done something funky on your MS SQL Server installation, and for "tds version" 8.0 corresponds to SQL Server 2000. (See http://www.freetds.org/userguide/tdshistory.htm for more on versions.) If you have more that one server you can add another block. 3) Tell UnixODBC where to find the FreeTDS driver and give it a name: If /etc/odbcinst.ini does not include a block named "FreeTDS" copy the content of /usr/share/doc/libct1/examples/odbcinst.ini to /etc/odbcinst.ini to let UnixODBC know about the FreeTDS driver. /etc/odbcinst.ini should now look something like this: [FreeTDS] Description = FreeTDS 0.61-5 Deb Driver = /usr/lib/odbc/libtdsodbc.so Setup = /usr/lib/odbc/libtdsS.so FileUsage = 1 CPTimeout = 5 CPReuse = 5 where "FreeTDS" is the driver name. In this file you can also define ODBC drivers for MySQL, generic ODBC, etc. 4) Make a named ODBC definition, with a specified FreeTDS database: Edit /etc/odbc.ini and add a block looking something like this: [BDataTDS] Description = Not That Important Data Server, FreeTDS connection Driver = FreeTDS Servername = BData Database = BigApplicationDB where "BDataTDS" is the ODBC name to give to your application on the Ubuntu box (e.g. Open Office), "Description" is just that, "Driver" is the name defined in /etc/odbcinst.ini (in step 3), "Servername" is the name defined in /etc/freetds/freetds.conf (in step 2), and "Database" is the database you want to connect to on the MS SQL Server. If you want to connect to more than one database, add another block here. If it is on the same MS SQL Server you use the same "Servername", if it is a different one, you have to add another block in step 2. 5) Try connection to the database, using the the unixODBC tool isql: isql -v BDataTDS Look at http://www.freetds.org/userguide/ for more in depth help!
Friday, July 9, 2010
MSSQL Perl Ubuntu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment