Skip to Content.
Sympa Menu

freetds - Odd program behavior

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Ian Charnas" <icc AT po.cwru.edu>
  • To: freetds
  • Subject: Odd program behavior
  • Date: Wed, 26 Jan 2000 1:17:46


Hello, I'm a college programmer writing some apache authentication modules,
and I'm currently working on mod_auth_tds which will authenticate users via
a Sybase or MS SQL database server. I'm currently planning on using
freetds as my C interface into the database servers.

I wish I could have figured this out myself, but I can't. I read the FAQ
over and over, I read all the archived messages from the mailing list, and
I looked through all the pertinant source code, but I still can't figure
out how to fix this problem:

I compiled the code found at the bottom of the message, which is simply a
test to see if the program can login correctly to the SQL server, and it
connects to myserver1 correctly. myserver1 is a development server running
NT 4.0 server and SQL 7.0.

The problem is when I try to connect to the production server (myserver2
let's call it) running the same operating system and the same SQL Server
(same versions of course). That continually fails on login. I'm sure the
username/password is correct, I'm fairly sure the interfaces file is
correct in syntax, and I configured FreeTDS --with-tdsver=4.2 as I should
have.

The odd thing is I can however, connect to both myserver1 and myserver2 if
I write the code in perl and use DBD::Sybase and the DBI scheme, which lets
me know it's not a network problem, my username/password is correct, and so
on.

So, I set the TDSDUMP environment variable and the following is a partial
printout of the error according to the log file...(I neglected to include
the printout of what packets were sent, because they contain my
username/password)
/****************************/
2000-01-26 01:13:10 inside tds_process_login_tokens()
2000-01-26 01:13:11 inside tds_process_default_tokens() marker is aa
2000-01-26 01:13:11 inside tds_process_default_tokens() marker is fd
2000-01-26 01:13:11 leaving tds_process_login_tokens() returning 0
/****************************/

Anyone have any idea as to what I can try to get this to work?


/****************************/
#include <stdio.h>
#include <tds.h>

int main() {
TDSLOGIN *login;
TDSSOCKET *tds;
int rc;
int i;

printf("Program started!\n");
login = tds_alloc_login();

tds_set_passwd(login, "mypass");
tds_set_user(login,"myuser");
tds_set_host(login, "myserver1");
tds_set_server(login, "myserver1");

tds_set_app(login, "Test...");
tds_set_library(login, "TDS-Library");
tds_set_charset(login, "iso_1");
tds_set_language(login, "us_english");
tds_set_packet(login,512);

if (!(tds = tds_connect(login))) {
fprintf(stderr, "Login Failed!\n");
exit(1);
}

printf("Done Connecting...\n");
return 0;
}
/****************************/




Archive powered by MHonArc 2.6.24.

Top of Page