Skip to Content.
Sympa Menu

freetds - [freetds] Connecting to DB using unixODBC from C

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Rattan, Neeta S" <nsratta AT sandia.gov>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Connecting to DB using unixODBC from C
  • Date: Tue, 17 Apr 2007 17:03:55 -0600

Hi,

I am very new to using freetds and am still at the point of connecting
to the DB using the unixODBC libs from C. I am using:
SQL Server version 8.0/Win2K
FreeTDS version 0.64
Client is Suse Linux

I have been able to successfully run and connect using both tsql and
isql, although I need to specify the username and password at the
command line as I was not using the DSN-less connect, so setting the
UID/PWD fields in the .ini files wouldn't be fruitful. Even if I set
them, and then leave out that info at the command line, it fails to
connect with error of "login failed for user ''" (ie. it thinks user is
blank).

However, from my C code using the SqlDriverConnect() function, I keep
getting a failed to connect error. I am specifying my connection string
to be "DSN=<dsnname>;UID=neeta;PWD=xxx" with no luck. If there are
thoughts on why this might be happening, I would much appreciate it!

In the meantime I am going to try to compile some of the sample code in
src/ although briefly looking at it, it looks quite similar to mine.

Thanks in advance,
Neeta Rattan





Archive powered by MHonArc 2.6.24.

Top of Page