[freetds] (newbie) Using tsql in C/C++

Brian Bruns brian.bruns at gmail.com
Tue Apr 26 06:38:37 EDT 2005


Is there a character in your password that may be getting interpreted
by the shell (*, ?, \, etc..) ?  Try wrapping the password in single
quotes such as -P 'my*password'

Brian

On 4/26/05, Ben Borofka <bborofka at gmail.com> wrote:
> This looks like what I need to use. However, I seem to have trouble
> connecting to the database with your tool. I keep getting an error:
> 
> bsqldb.c:170: failed assertion `dbproc != NULL'
> 
> And when I comment out that line, I get a bus error. I am launching
> it with the same arguments I launch tsql with:
> 
> $ bsqldb -S server -U username -P password
> 
> tsql seems to be the only thing I can connect to the server with, but
> a strange thing seems to happen with that. If I try to connect with
> the password as an argument (...-P password...), I cannot connect.
> However, if I try connecting without the argument, then just type the
> password in when it prompts me, it will connect. Anyone know the
> reason for this?
> 
> Ben
> 
> On Apr 21, 2005, at 6:59 PM, James K. Lowden wrote:
> 
> > Ben Borofka <bborofka at gmail.com> wrote:
> >
> >>
> >> I'm writing an app (in Objective-C/Cocoa) that needs to connect to a
> >> MS SQL 2000 Server. I'm able to compile and run tsql on OS X and it
> >> works fine. I can connect to the server and issue SQL commands. Now I
> >> just need to figure out how to put this functionality in my program.
> >>
> >
> > Welcome.
> >
> >
> >> This is where I'm getting really confused. I need to find some C/C++
> >> code to do this, and the source code for freetds is really
> >> overwhelming and complicated. All I need to be able to do is connect
> >> to the server, exec a few stored procedures and get some output. I'm
> >> looking for some samples, but the Documentation doesn't explain much
> >> of using freetds w/ C at all.
> >>
> >
> > I wrote apps/bsqldb.c just for you.  You might not need everything it
> > does, but it's meant to be so that you can pull out what you need.
> >
> > As Brian said, db-lib is documented online by both vendors.  There
> > is also
> > a reference manual included in the distribution.
> >
> > For a super-brief introduction:
> >
> > install error and message handlers
> > dblogin
> > dbconnect
> > dbcmd
> > dbsqlexec
> > while dbresults
> >     dbbind col1
> >     ...
> >     dbbind colN
> >     while dbnextrow
> >         [process data]
> >     wend
> > wend
> >
> > We speak of "results" as the output of a select statement.  Because a
> > query sent with dbcmd may have more than one select statement, we
> > may get
> > several results.  Hence the nested loop.
> >
> > --jkl
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS at lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> >
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>



More information about the FreeTDS mailing list