Difference between tsql and libsybdb

Alberto Pulvirenti <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAJNp6N2Z6=vD1AFeWOBSV52REJ4yZikt22HzZJNKxYRMK9kgzA@mail.gmail.com>
Dear all,

after some time I tried to find a solution to this problem, I preferred to
send a request directly to this mailing list, since I suppose that experts
about freeTDS will be looking at it and find a solution maybe quite easily.

I have implemented a C++ class which makes use of the libsybdb to connect
to a SQL Server 2008 database and allow for some standard queries.
I had to use this class inside a network which made me available a SQL
Server DB in an instance that applies a Logon trigger.
Now, what happens is the following. If I try to access this instance using
the "tsql" executable which comes together to the freeTDS source package (I
am using 0.91, the latest stable release I found in the site), then I
manage to login correctly, I get the prompt and I can successfully execute
queries on the DB which is allowed for me to access.
Instead, if I try to log into the same DB on the same instance using my
class, it fails because it is kicked out by the logon trigger.
What I do is just creating a LOGINREC object and set it with what is needed
to access the DB (user, password, port, host, etc,), which is nothing more
and nothing less than what I put in the command line when I call tsql.

I called the admins of that SQL Server instance and the only help I got was
the log of some error message which is the following:

>> SELECT failed because the following SET options have incorrect settings:
'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'.
>> Verify that SET options are correct for use with indexed views and/or
indexes on computed columns and/or filtered indexes and/or query
notifications
>> and/or XML data type methods and/or spatial index operations

the point is that I don't understand if this is a critical failure point
and, if it is, what should I add to the connection to avoid this failure.
What I do is similar to what I have always seen in the examples about how
to set up a connection:

// allocate login params
LOGINREC *login; if ((login = dblogin()) == FAIL)
__LOG_ERROR_RETURN(CROWD_ERR_DB_FAILURE, log_preamble() << "failed to
initialize login object") // setup login params DBSETLUSER(login,
user.c_str()); DBSETLPWD(login, pwd.c_str()); DBSETLAPP(login,
"CrowdForce"); DBSETLCHARSET(login, "utf8"); DBSETLDBNAME(login,
db_name.c_str()); if (gethostname(hostname, max_len) == 0)
DBSETLHOST(login, hostname); else __LOG_ERROR_RETURN(CROWD_ERR_DB_FAILURE,
log_preamble() << "failed to retrieve hostname") // connect to DB engine
and free login object m_connection = dbopen(login, db_conn.c_str());
dbloginfree(login); if (m_connection == NULL)
__LOG_ERROR_RETURN(CROWD_ERR_DB_FAILURE, log_preamble() << "failed to open
connection")
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.