[JDEV] XDB / ODBC

Michel Oosterbeek oosterbeek.mah at stu.hsbrabant.nl
Fri Feb 22 05:23:50 CST 2002


Hi all,

> there is a function called xdbodbc_query in xdb_sql_odbc.c
> If you add a debug messeage to echo out the query that is be query that
> is being executed you will be able to pin point the error.

It never gets there. But I did take up the advice mentioned above in the
part where the crash occurs: the file "xdb_sql_odbc.c".
I've added some debug messages to the function "xdbodbc_is_connected"
(because it seems to go wrong there - for code, se below). And the result I
got was SQL_INVALID_HANDLE. Correct me if I'm mistaking, but the handle is
created in "xdbodbc_connect", right? Still there's no sign of anything going
wrong there. But later, when at the end of that function it calls
"xdbodbc_is_connected", then it seems to go wrong anyway. How could those
earlier checks have been passed OK then?
The ODBC-environment is working OK, already several other programs are using
it. Also the username, password, etc. have been checked and are filled in
OK. I've also kept watch to the content of self->dbc throughout the process,
that also seems OK.

I still think it's something simple that I am overlooking somehow....

Thanks,

Michel

------------------------------

short xdbodbc_is_connected (XdbODBCBackend *self) {
 static SQLCHAR buffer[255];
 SQLSMALLINT outlen ;
 SQLRETURN ret;
 if (!(self->dbc))
  return 0;

 ret = SQLGetInfo(self->dbc,SQL_DATA_SOURCE_NAME,
buffer,sizeof(buffer),&outlen);

 /* -= Start of the piece I included =- */

 if (SQL_ERROR == ret){
  log_debug(ZONE, "ret contains SQL ERROR! ");
   } /* end if */
 if (SQL_SUCCESS_WITH_INFO == ret){
  log_debug(ZONE, "ret contains SQL SUCCESS WITH INFO! ");
   } /* end if */
 if (SQL_INVALID_HANDLE == ret){
  log_debug(ZONE, "ret contains SQL INVALID HANDLE! ");
   } /* end if */
   if (SQL_SUCCESS == ret){
  log_debug(ZONE, "ret contains SQL SUCCESS! ");
   } /* end if */

 /* -= End of the piece I included =- */

 if (!SQL_SUCCEEDED(ret))
  return 0;

/* Also added this, but we never get here */
 log_debug(ZONE, "is_connected will return 1 :o)");

 return 1;
}



-= Original Message =-

> > Michel Oosterbeek wrote:
> >
> > Hi,
> >
> > Still having problems here. Right now I'm using:
> > - Red Hat 7.2
> > - Jabber 1.4.1
> > - xdb_sql
> > - db2 (I connect through ODBC)
> >
> > All settings seem to be correct (jabber.xml and xdb_sql.xml), all info
is
> > inserted correctly (hostname, user, pw - checked and double checked),
but
> > the connection seems to fail somehow. I have included some debug-info
below.
> > I've kept everything 'basic' (no changes), and the odbc-connection has
also
> > been tested and proved working with other c-programs, so that can't be
it.
> >
> > Any idea what this could be?
> >
> > Thanks,
> >
> > Michel.
> >
> >
> > -= Debug Output =-
> >
> > Thu Feb 21 13:07:25 2002  xdb.c:41 xdb_results checking xdb packet <xdb
> > type='result' to='xdb' from='config at -internal'
ns='jabberd:xdb_sql:config'
> > id='0'><xdb_sql xmlns='jabberd:xdb_sql:config'>
> >     <backend>odbc</backend>
> >     <connection>
> >       <host>dbpc</host>
> >       <db>testdb</db>
> >       <user>testuser</user>
> >       <pass>testpw</pass>
> >     </connection>
> >     <queries>
> >       <querydef name='auth-get'>
> >         <text>
> >           SELECT password FROM users WHERE username =
> > &apos;$$username$$&apos;
> >         </text>
> >         <bindvar name='user'>$$username$$</bindvar>
> >         <bindcol name='password' offset='0'/>
> >       </querydef>
> >       <querydef name='auth-set'>
> >         <text>
> >           UPDATE users SET password = &apos;$$p$$&apos; WHERE username =
> > &apos;$$username$$&apos;
> >         </text>
> >         <bindvar name='user'>$$username$$</bindvar>
> >         <bindvar name='password'>$$p$$</bindvar>
> >       </querydef>
> >     <querydef name
> > Thu Feb 21 13:07:25 2002  log.c:105 <log type='alert'
> > from='-internal'>[xdbsql_config_init] cannot connect database :
> > </log>
> > Thu Feb 21 13:07:25 2002  log.c:105 <log type='alert'
> > from='-internal'>[xdb_sql] configuration failed</log>
> > Thu Feb 21 13:07:25 2002  deliver.c:277 Registering c2s with instance
c2s
> > Thu Feb 21 13:07:25 2002  client.c:440 pthsock_client loading
> > Thu Feb 21 13:07:25 2002  deliver.c:235 @-internal processing <xdb
> > type='get' to='config at -internal' from='c2s' ns='jabber:config:pth-csock'
> > id='0'/>
> > Thu Feb 21 13:07:25 2002  deliver.c:649 delivering to instance 'c2s'
> >
> > ................
> >
> > Thu Feb 21 13:07:25 2002  mio.c:1115 io_select to listen on 5269
[(null)]
> > Thu Feb 21 13:07:25 2002  dnsrv.c:132 DNSRV CHILD: starting
> > Thu Feb 21 13:07:25 2002  mio.c:1139 io_select starting to listen on
5269
> > [(null)]Thu Feb 21 13:07:25 2002  dnsrv.c:147 DNSRV CHILD: Read from
buffer:
> > <stream>
> >
> > Thu Feb 21 13:07:25 2002  deliver.c:460 DELIVER 3:-internal <log
> > type='alert' from='-internal'>[xdbsql_config_init] cannot connect
database :
> > </log>
> > Thu Feb 21 13:07:25 2002  deliver.c:649 delivering to instance 'elogger'
> > 20020221T12:07:25: [alert] (-internal): [xdbsql_config_init] cannot
connect
> > database :
> >
> > Thu Feb 21 13:07:25 2002  deliver.c:460 DELIVER 3:-internal <log
> > type='alert' from='-internal'>[xdb_sql] configuration failed</log>
> > Thu Feb 21 13:07:25 2002  deliver.c:649 delivering to instance 'elogger'
> > 20020221T12:07:25: [alert] (-internal): [xdb_sql] configuration failed
> > Thu Feb 21 13:07:25 2002  mio.c:624 socket 9 has restore karma -100 -=>
50
> >
> >
> >
> > _______________________________________________
> > jdev mailing list
> > jdev at jabber.org
> > http://mailman.jabber.org/listinfo/jdev





More information about the JDev mailing list