I just installed the ODBC driver in the Ubuntu, but still I am facing issues while connecting the database from Perl. Here is the description on what I have done in my machine.
I installed the MSSQL Driver and Unix ODBC from easysoft website. The path details in my machine follows:
ODBC Installed Path:- user/local/easysoft/unixodbc
Data Source and Driver path: user/local/etc Sample Code:
#!/usr/bin/perl
use strict;
use DBI;
my $dsn="DBI:ODBC:DRIVER={SQL Server};Server=xxx.xxx.xxx.xxx,1433;database=DB_name";
my $dbh = DBI->connect($dsn, "username", "password" ,{AutoCommit => 1} )
or die DBI::errstr;
Error:
DBI connect('DRIVER={SQL Server};Server=xxx.xxx.xxx.xxx,1433;database=DB_name','username',...) failed: unixODBCDriver Manager Can't open lib 'SQL Server' : file not found (SQL-01000) at sample.pl line 5
unixODBCDriver ManagerCan't open lib 'SQL Server' : file not found (SQL-01000) at sample.pl line 5.
DRIVER={SQL Server}
You code is attepmting to connect to a [SQL Server] driver in your odbcinst.ini file. However if you are using the Easysoft ODBC-SQL Server Driver you will need to use :-
Driver={Easysoft ODBC-SQL Server}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With