Skip to Content.
Sympa Menu

freetds - [freetds] ct_connect returns failure

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "developer loke" <developer.loke AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] ct_connect returns failure
  • Date: Wed, 19 Nov 2008 21:42:40 -0500

Hi. This is my first post. I am a novice in freetds programming, and am
trying to connect to a Microsoft Server 2008. I am able to connect with
tsql -Svirtual -Usa -Ddatabase -Ppass. I have set the environment
variable TDSVER=8.0 . I am trying to use the included c code, but the
return at the last line in the following code is 0. What am I doing
wrong?
Loke

code:
int main()
{
CS_CONTEXT *ctx;
CS_CONNECTION *conn;
CS_COMMAND *cmd;
CS_RETCODE ret;
CS_RETCODE restype;
CS_DATAFMT datafmt[10];

ret = cs_ctx_alloc(CS_VERSION_100, &ctx);
ret = ct_init(ctx, CS_VERSION_100);
ret = ct_con_alloc(ctx, &conn);
ret = ct_con_props(conn, CS_SET, CS_USERNAME, "sa", CS_NULLTERM,
NULL);
ret = ct_con_props(conn, CS_SET, CS_PASSWORD, "pass", CS_NULLTERM,
NULL);
/* ret = ct_con_props(conn, CS_SET, CS_IFILE,
"/devl/t3624bb/myinterf", CS_NULLTERM, NULL); */
//always returns zero
ret = ct_connect(conn, "virtual", CS_NULLTERM);




Archive powered by MHonArc 2.6.24.

Top of Page