3

I need to connect to a mssql 2008 database using perl (12.2) and freetds 0.91 on a CentOS box and can do it successfully with a user defined on the database. However, I need to switch to a domain user and I have not been able to figure out what I need to do to get it to work. It looks to be correctly setup on the database and here is my connection string:

my $dsn = [
    "DBI:Sybase:database=adx;server<server_name>",
    '<DOMAIN>\\<user>',
    '<password>',
    {
        PrintError  => 0,
        RaiseError  => 0,
        AutoCommit  => 0
    }
];

Here is the error message:

database connection failed for DBI:Sybase:database=<db_name>;server=<server_name>
<DOMAIN>\\<user> : OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (34)
Server <server_name>, database
Message String: Adaptive Server connection failed

I believe the tds error (LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (34)) is indicating the login failed, but I am sure the password is correct and have tried it directly on a mssql client. Anyone get this to work?

3
  • have you tried it hardcoded ? : $dbh = DBI->connect("dbi:Sybase:server=BILLING","meuser","mypassw"); Commented Jul 27, 2012 at 23:35
  • Why use Sybase to connect to mssqsl. There is a Class::DBI::MSSQL Commented Jul 28, 2012 at 3:07
  • I have tried that hardcoded syntax. Did not work. And DBI::MSSQL requires ODBC so that would require me to install and configure unixODBC and I was not able to get that to work the last time I tried. I am already connecting using DBI::Sybase to mssql using regular mssql database accounts. Commented Jul 30, 2012 at 18:13

1 Answer 1

2

The only successful way that i have found to connect to SQL server(DBD::ODBC) from Linux is using ODBC, the SyBase module should be used with an instance of Sybase and not with SQL Server ...

The connection string to use with ODBC should looks like the following :

 "DBI:ODBC:driver={SQL Server};Server=192.168.1.1,1433;database=db_name";
Sign up to request clarification or add additional context in comments.

2 Comments

mssql is based on Sybase and I am using DBI::Sybase with freetds 0.91. It works for a number of regular mssql database accounts, but I have not yet found how to get it to work with a domain account.
Yes, however i think that could be better going with ODBC, especially in this case ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.