Re: Using sqgetdbs core dumps program
Posted in 2004
Topics: Server Administration
Mike Aubury <mike@aubit.com> wrote in message news:<4055c039$0$31687$fa0fcedb@lovejoy.zen.co.uk>...
> snorris wrote:
> >
> > #define BUFFSZ 256
> > #define NUM_DBNAMES 10
> >
> > int
> > main()
> > {
> > char db_buffer[BUFFSZ];
> > char *dbnames[NUM_DBNAMES];
> > int num_returned, ret, i;
> >
> > printf("\\nFirst call to sqgetdbs.\\n");
> > ret = sqgetdbs(&num_returned, dbnames, NUM_DBNAMES, db_buffer,
> > BUFFSZ);
>
> dbsnames should be (i think) NUM_DBNAMES+1 in size...
>
> Have you got >=10 remote databases but <10 local ones ?
You are correct, it should be +1. However, I only have 2 local
databases and 4 remote databases so I don't think that it's a boundry
violation with any of the variables used in the sqgetdbs call. I
wonder how dbaccess gets the database list? It (dbaccess) works just
fine pointed to a remote database server... which says that it either
does not use sqgetdbs, or there is something else you must do to use
sqgetdbs with a remote server that's not revealed in the
documentation.
scott0@snet.net (snorris) wrote in message news:<c0db828.0403151226.42a24c31@posting.google.com>...
> Mike Aubury <mike@aubit.com> wrote in message news:<4055c039$0$31687$fa0fcedb@lovejoy.zen.co.uk>...
> > snorris wrote:
> > >
> > > #define BUFFSZ 256
> > > #define NUM_DBNAMES 10
> > >
> > > int
> > > main()
> > > {
> > > char db_buffer[BUFFSZ];
> > > char *dbnames[NUM_DBNAMES];
> > > int num_returned, ret, i;
> > >
> > > printf("\\nFirst call to sqgetdbs.\\n");
> > > ret = sqgetdbs(&num_returned, dbnames, NUM_DBNAMES, db_buffer,
> > > BUFFSZ);
> >
> > dbsnames should be (i think) NUM_DBNAMES+1 in size...
> >
> > Have you got >=10 remote databases but <10 local ones ?
>
> You are correct, it should be +1. However, I only have 2 local
> databases and 4 remote databases so I don't think that it's a boundry
> violation with any of the variables used in the sqgetdbs call. I
> wonder how dbaccess gets the database list? It (dbaccess) works just
> fine pointed to a remote database server... which says that it either
> does not use sqgetdbs, or there is something else you must do to use
> sqgetdbs with a remote server that's not revealed in the
> documentation.
Before I give up on getting this to work, I wanted to post one last
piece of information I just discovered. If the client's protocol is
sesoctcp, then the code I posted works as expected, i.e. it prints the
remote database list twice. However, if the client's protocol is
setlitcp then the same code prints the database list once and then
core dumps on the second call to sqgetdbs. I can't simply choose to
use sesoctcp because it's not supported under Unixware and am
therefore stuck with using setlitcp.
Thanks to all who have posted a suggestion.
On Tue, 16 Mar 2004 11:21:07 -0500, snorris wrote: <SNIP> Umm, soctcp and tlitcp (ie Sockets and TLI) are FULLY COMPATIBLE at the network level. They are just different function call APIs to accomplish the EXACT SAME communications protocols, namely TCP/IP! The server, I presume that's the Unixware system, will publish the protocol in its sqlhosts file as setlitcp (or ontlitcp as appropriate to the engine type) and the client will use sesoctcp (or onsoctcp) in its sqlhosts file or connection setup. That will work just fine. It sounds like the client has an existing but broken implementation of the TLI library while its Sockets lib works fine. Art S. Kagel > Before I give up on getting this to work, I wanted to post one last piece of > information I just discovered. If the client's protocol is sesoctcp, then > the code I posted works as expected, i.e. it prints the remote database list > twice. However, if the client's protocol is setlitcp then the same code > prints the database list once and then core dumps on the second call to > sqgetdbs. I can't simply choose to use sesoctcp because it's not supported > under Unixware and am therefore stuck with using setlitcp. > > Thanks to all who have posted a suggestion.