Skip to Content.
Sympa Menu

freetds - RE: Help required

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: Help required
  • Date: Wed, 14 Aug 2002 11:10:04 -0400


> From: John Seers [mailto:John.Seers AT uk.lionbioscience.com]
> Sent: August 14, 2002 3:50 AM
>
> Thanks for replying and sorry for taking up your time.

You're welcome and please don't apologize. The ML is here for everyone to
use and improve FreeTDS; a mailing list without questions wouldn't
accomplish that.

> I can with my small trial C program with 0.53. But it fails
> with the C++ program.

I doubt it's a C++ issue, but I think we'll know for sure soon enough.

> > IIRC, unittest #4 is currently broken.
> No, all the [current snapshot] tests failed.
> I will leave that for now

That sounds like PWD or freetds.conf isn't right in that setup. You're
right, either version will do the basic job. I think cvs will stabilize in
the next few weeks, but just now there is a riot of patches for me to apply.
(Not that I'm complaining, except about lack of time!)

> > you might want to "export TDSVER=7.0", just to be sure
>
> I have just tried that but no improvement.

As expected. :(

> > It's probably worthwhile to install your own handler.
>
> Oh dear. I do not have the time at the moment as I have some
> development deadlines to meet.
> (The first of which is find out how to
> access MS SQL Server from a unix box!).
...
> So, is it usual to have your own handler and not use the default? In
> brief what would that involve?

See http://sybooks.sybase.com/middleware.html. Under "Open Client/Server",
you'll find

Open Client and Open Server Common Libraries Reference Manual
Open Client Client-Library/C Programmer's Guide
Open Client Client-Library/C Reference Manual

Look for "message handler". It's not really that hard. It's just that you
have to define a pointer to a function, and most people don't do that often
enough to get it right on the first or even eighth try.

(There are two handlers, one for messages and one for errors. Many people
write db-lib/ct-lib code for years without knowing the difference, so let me
save you time: Messages come from the server, and Errors come from the
library.)

You can also look at sqsh's code for an example.

Basically, you define a callback function whose arguments are specified by
ct-lib. That function will be called whenever the server sends an
out-of-band (non-data) message to the client. Your function can print the
message, ignore it, send it to your Aunt Lucy, whatever.

For any but trivial programs, a handler is necessary. (That doesn't mean
our default behavior should be a segfault, though. :/ ) Even if the
(working) default handler's behavior is acceptable for most things, sooner
or later you'll want to intercept some message (by number) for special
handling.

> As I am still at the stage of choosing
> how we should access MS SQL Server from a unix box can you give me some
> pointers on why I should/should not choose freetds? I do not have the
> time at the moment to take on extra development.

If you don't choose FreeTDS, how will I make my quota this month? And what
about my commission?

As we lay out in the User Guide, there really is no good alternative, IMHO.
Of the proprietary alternatives, all lack BCP. Some actually use FreeTDS
under the hood. None is faster.

>From the sounds of what you're doing -- writing/adapting your own C or C++
-- you have some control over what functionality you need, and even some
ability to supply functionality. That, as far as I can see, makes you a
typical FreeTDS candidate.

> I have not got religion yet. :)

John, it looks from here that the problems you've had so far have mostly
been part of the process of learning a new library in a new environment. In
such a situation, it's nice to have a reliable benchmark to help isolate
problems. You might want to install Sybase for Linux (free to download),
which of course comes with Sybase's ct-lib and documentation. It took me an
evening to set up. That would give you a reliable ct-lib to test against,
so when your code fails you'd know if it's your program or FreeTDS that's
acting up. There are differences in the servers, but by the time they
matter, you'll be an experienced ct-lib programmer.

Regards,

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.






Archive powered by MHonArc 2.6.24.

Top of Page