[freetds] Registering the ODBC Driver With unixODBC
Robert Denton
robert at headsprout.com
Wed Apr 25 17:27:53 EDT 2007
Is there anything specific I need to do to make perl aware of the
freetds driver? Here is my set up:
FC4 -> PERL w/DBI -> DBD::ODBC -> unixODBC -> FreeTDS
The error that I get when I try to run the script is this:
Can't connect to data source driver={SQL
Server};Server=<192.168.0.149>;
database=<userFeedback>;uid=<testUser>; pwd=<testPass>;, no database
driver specified and DBI_DSN env var not set at ./feedback.pl line 11
However, my understanding is that the DBI_DSN env var (which I have
not explicitly set, not am I sure what to set it to if necessary) is
only called if the $data_source in the connect() statement is empty.
My connect() statement is as follows:
$dbh = DBI->connect( $data_source, $username, $password );
And my $data_source var is set to this:
my $data_source = 'driver={SQL Server};Server=<192.168.0.149>;
database=<userFeedback>
;uid=<testUser>; pwd=<testPass>;';
I have seen other syntax for the connect statement for other
databases such as MySQL and Oracle but never for MSSQL. I have
searched dbi.perl.org as well for example syntax but all the examples
I can find there are also for non-MS databases. If anyone knows of
an alternative syntax that they know for certain works for MSSQL that
would be terrific.
As for the other part of the error, "no database driver specified", I
am not sure what else I need to do to make perl aware of the FreeTDS
driver. I have 'use DBI;' in the top of the script which is supposed
to be sufficient. In otherword, I do not believe that I need to tell
it to use DBD::ODBC. Further, I specified the install dir for
unixODBC when I installed DBD::ODBC through cpan. Finally, I
registered FreeTDS with unixODBC using template files and odbcinst
commands.
What am I missing here? It seems to me that there is some piece of
the puzzle that I am overlooking that will bring all of this
together. If no one knows the answer I would love to at least see
some pointers to guides/tutorials/examples etc of how this set up is
supposed to work. The examples at dbi.perl.org and in Programming
the Perl DBI seem to never include MSSQL examples, unfortunately.
Robert
On Apr 25, 2007, at 3:31 PM, Jäger, Olaf wrote:
> Hi,
>
> That must be a typo in the tutorial. Instead of -t try -f (for
> template file ;-) This worked for me.
>
> Cheers
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: freetds-bounces at lists.ibiblio.org [mailto:freetds-
> bounces at lists.ibiblio.org] Im Auftrag von Robert Denton
> Gesendet: Mittwoch, 25. April 2007 20:09
> An: FreeTDS at lists.ibiblio.org; dbi-users at perl.org
> Betreff: [freetds] Registering the ODBC Driver With unixODBC
>
>
> Hi folks.
>
> I am attempting to get freetds to work with unixODBC. I found this
> tutorial:
>
> http://www.unixodbc.org/doc/FreeTDS.html
>
> It calls for creating a file called tds.driver.template with the
> following lines:
>
> [FreeTDS]
> Description = v0.63 with protocol v8.0
> Driver = /usr/local/freetds/lib/libtdsodbc.so
>
> However, I installed version .64-4 and the so is /usr/lib/
> libtdsodbc.so.0 so I modified the tds.driver.template file
> accordingly.
>
> Then, the tutorial has you run 'odbcinst -i -d -t /etc/
> tds.driver.template
>
> but then gives the error: odbcinst: Unknown option t
>
> Is there a different way to associate the freetds driver with
> unixODBC? There doesn't seem to be a man page for odbcinst.
>
>
> Robert
>
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org http://lists.ibiblio.org/mailman/listinfo/
> freetds
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
More information about the FreeTDS
mailing list