freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD
- Date: Thu, 20 Sep 2007 15:47:55 +0200
>
> The source for the connnect() function is as follows:
>
> int DBConnection::connect()
> {
> LOGINREC *login;
> DBPROCESS *dbproc;
> RETCODE rc;
>
> rc = dbinit();
> if (rc == FAIL) {
> fprintf(stderr, "%d: dbinit() failed\n", __LINE__);
> }
>
> dbopen();
>
??? well.. I mistake, dbinit, not dbopen here...
> DBSETLUSER(login, USER); // segmentation fault occurs here
cause login is not initialized, DBSETLUSER should be called after a
dblogin.
If you use gcc -Wall can help
> DBSETLPWD(login, PASSWORD); // also here, if previous
> line is commented out
>
> login = dblogin();
>
> assert(login != NULL );
>
> dberrhandle(err_handler);
> dbmsghandle(msg_handler);
>
> dbproc = dbopen(login, "MyServerDev");
> assert(dbproc != NULL);
>
> dbuse(dbproc, "bioinformatics");
>
> }
correct order should be
dbinit
dberrhandle+dbmsghandle
dblogin
DBSETLUSER+DBSETLPWD
dbopen
dbuse
freddy77
>
> -----Original Message-----
> > I don't know what the "cstb" is in reference to, but I have
> > found a simple example written in C that allows my program to
> > change the username and password. I had been reading many
> > conflicting examples that included combinations of sybdb.h,
> > tds.h, and dblib.h. Using only sybdb made my code simpler
> > and allowed the message handler to run. Thank you for your help.
> >
>
> 0x63737462 is "cstb" (or "btsc" depending on byte order).
> It's quite strange that a pointer is composed only by lower case
> bytes... it seems a corruption or a wrong structure use. I
> think source
> for DBConnection::connect would help.
>
> Does a simple code like
>
> dbopen
> dblogin
> DBSETLUSER
>
> works??
>
> freddy77
>
-
[freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Amanda Wise, 09/18/2007
- <Possible follow-up(s)>
-
[freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Amanda Wise, 09/18/2007
- Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD, James K. Lowden, 09/18/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Frediano Ziglio, 09/19/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Amanda Wise, 09/19/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
ZIGLIO, Frediano, VF-IT, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Amanda Wise, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
ZIGLIO, Frediano, VF-IT, 09/20/2007
- Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD, Amanda Wise, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
ZIGLIO, Frediano, VF-IT, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Amanda Wise, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
James K. Lowden, 09/20/2007
- Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD, Amanda Wise, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
ZIGLIO, Frediano, VF-IT, 09/20/2007
-
Re: [freetds] Segmentation fault in DBLIB - SETUSER/SETPWD,
Amanda Wise, 09/19/2007
Archive powered by MHonArc 2.6.24.