freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Brian Bruns" <camber AT ais.org>
- To: freetds
- Subject: Re: dblib sample program does not run
- Date: Thu, 2 Sep 1999 11:43:16
The aclocal problem is a known bug and should be fixed when 0.47 is release
(You should be able to 'touch Makefile.in' and it'll correct it. It just
thinks that Makefile.am is newer and wants to regen it.
So after you got it compiled what did it do when you tried to run the
sample?
By the way, the sample hook up message handlers so if you are getting an
error from the server you're not seeing. I would recommend trying to run
SQSH and see if that works. Also you may try the tdstest.c in the samples
directory (after changing it to point at your server) to test that.
Cheers,
Brian
On 09/02/99, "Kenny Pang <eekhpang AT ee.ust.hk>" wrote:
> Dear Brian
>
> Couldn't get the result supposed to be. Looks like the configuration is
> incorrect. I
> followed the standard way:
>
> ./configure --with-tdsver=4.2
> ./make
> ./make install
>
> Originally it failed in ./make:
>
> cd . && aclocal
> aclocal: configure.in: 14: macro `AM_PROG_LIBTOOL' not found in library
> make: *** [aclocal.m4] Error 1
>
> After the make failed, I renamed /usr/bin/aclocal somewhere else. Then the
> make
> passed. I am not sure it is the cause of the problem. By the way, the
> environment I am
> trying to compile is Redhat 6.0.
>
> Any idea
> Best regards,
> (puzzling)Kenny
>
> Brian Bruns wrote:
>
> > Here is 0.46 running against the JDBC server (in the interfaces), the only
> > changes are for login information and the database name was changed to
> > pubs2.
> >
> > Can you test it against the JDBC server to determine if it is specially
> > related to SQL 7.0 or your configuration. The server is in the interfaces
> > but you'll need an internet connection to get to it of course.
> >
> > Brian
> >
> > [camber@amd133 samples]$ !cc
> > cc -o sample sample.c -I/usr/local/freetds/include
> > -L/usr/local/freetds/lib -lsybdb -lnsl
> > [camber@amd133 samples]$ ./sample
> > White from Menlo Park
> > Green from Oakland
> > Carson from Berkeley
> > O'Leary from San Jose
> > Straight from Oakland
> > Bennet from Berkeley
> > Dull from Palo Alto
> > Gringlesby from Covelo
> > Locksley from San Francisco
> > Yokomoto from Walnut Creek
> > Stringer from Oakland
> > MacFeather from Oakland
> > Karsen from Oakland
> > Hunter from Palo Alto
> > McBadden from Vacaville
> > [camber@amd133 samples]$
> >
> > On Wed, 1 Sep 1999, Kenny Pang wrote:
> >
> > > Hi
> > > I am new to FreeTDS. I successfully compiled and installed freetds 0.46
> > > in Redhat Linux 6.0. It was configured with "--with-tdsver=4.2".
> > > However when I try some very sample programs to retrieve rows from a MS
> > > SQL server, the results are not the one I expected. The sample program
> > > is extracted from the MS SQL server 7.0 online book. It caused
> > > segmentation fault in the line
> > >
> > > while (dbnextrow(dbproc) != NO_MORE_ROWS)
> > >
> > > When total while block is commented, it runs but the printf outputs some
> > > rubbish, instead of the correct column.
> > >
> > > The sample program and the compile option is attached. Can somebody tell
> > > me what stupid mistake I have made or anything I have missed. Thanks a
> > > lot...
> > >
> > > cc -o sample.c sample.c -I/usr/local/freetds/include
> > > -L/usr/local/freetds/lib -lsybdb -lnsl
> > > ------------------------------------------------------------------
> > > sample.c
> > > ------------------------------------------------------------------
> > > #include <stdio.h>
> > > #include <sqlfront.h>
> > > #include <sqldb.h>
> > > main()
> > >
> > > {
> > > DBPROCESS *dbproc; // The connection with SQL Server.
> > > LOGINREC *login; // The login information.
> > > DBCHAR name[100];
> > > DBCHAR city[100];
> > >
> > > // Install user-supplied error- and message-handling functions.
> > > dbinit ();
> > >
> > > // Get a LOGINREC.
> > > login = dblogin();
> > > DBSETLUSER(login, "sa");
> > > DBSETLPWD(login, "");
> > > DBSETLAPP(login, "example");
> > >
> > > // Get a DBPROCESS structure for communication with SQL Server.
> > > dbproc = dbopen(login, "eex861");
> > > // Retrieve some columns from the authors table in the // pubs
> > > database.
> > >
> > > // First, put the command into the command buffer.
> > > dbcmd(dbproc, "SELECT au_lname, city FROM pubs..authors");
> > > dbcmd(dbproc, " WHERE state = 'CA' ");
> > >
> > > // Send the command to SQL Server and start execution.
> > > dbsqlexec(dbproc);
> > >
> > > // Process the results.
> > > if (dbresults(dbproc) == SUCCEED)
> > > {
> > > // Bind column to program variables.
> > > dbbind(dbproc, 1, NTBSTRINGBIND, 0, name);
> > > dbbind(dbproc, 2, NTBSTRINGBIND, 0, city);
> > > // Retrieve and print the result rows.
> > >
> > > while (dbnextrow(dbproc) != NO_MORE_ROWS)
> > > {
> > > printf("%s from %s\n", name, city);
> > > }
> > > }
> > >
> > > // Close the connection to SQL Server.
> > > dbexit();
> > > return(0);
> > >
> > >
> > > ---
> > > You are currently subscribed to freetds as: camber AT ais.org
> > > To unsubscribe, forward this message to $subst('Email.Unsub')
> > >
> > >
> >
> > ---
> > You are currently subscribed to freetds as: eekhpang AT ust.hk
> > To unsubscribe, forward this message to $subst('Email.Unsub')
-
dblib sample program does not run,
Kenny Pang, 09/01/1999
- <Possible follow-up(s)>
- Re: dblib sample program does not run, Brian Bruns, 09/01/1999
- Re: dblib sample program does not run, Brian Bruns, 09/01/1999
- Re: dblib sample program does not run, Kenny Pang, 09/02/1999
- Re: dblib sample program does not run, Brian Bruns, 09/02/1999
Archive powered by MHonArc 2.6.24.