Skip to Content.
Sympa Menu

freetds - Re: Changed database context?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Jonathan Hirschi" <jhirschi AT hotmail.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Changed database context?
  • Date: Tue, 18 Jun 2002 10:16:31 -0700



James and Brian,

Thanks for taking time to respond to these problems. I've been searching around the internet and other people who have had the same problem have generally found it to be a big endian problem, i guess where perl isn't recognizing the problems.. I installed the nightly snapshot version hoping that this would get rid of the problem, but it seems to persist. Anyway, that said.... On to the results of what you asked.

I put the PrintError => 10 in there hoping to stop the error statements from coming out. I also read the thing about it not printing statements less than 10, so I put that in there hoping to force it not to print out the statements. I found that it doesn't matter what number I set that to, it does nothing to stop the messages. Taking it out doesn't stop the messages either. Having it there basically does nothing. Setting it to 0 doesn't change the output.

I put the raiserror statments into the code and they were promptly outputed to the screen.

I have question about installing a new version. When this started out, I installed version 0.53. Then when I found out about the issue, I got the newest version I could and I compiled and installed it over the top of 0.53. I couldn't find anything in the documentation stating how to do it, so i assumed that was the correct way to do it. Did i need to uninstall the first one and then install the second one? Or does the second one just copy over the files from the first installation?

Also, I didn't install an error handler. This is a default installation.


So what are my options here..? the only thing left to do is install a custom error handler to get rid of these statements?


Also, something interesting to note. I get statements when using tds version 7.0.

Changed Database context to Bugdb.
Change Default Language to us_English.

I don't get the second one when using the Tds_version 4.2.

I don't know if that has any bearing on the problem.

Once again, thanks for the help guys.



John,

I doubt FreeTDS is writing anything directly to standard error; my code
grepping confirms Brian's recollection. I could be wrong; I don't have a
Solaris box set up to test with.

The message you're seeing about changing databases is generated by the
server. MySQL doesn't generate such a message; that's why you don't see it
from them.

A few DBI questions for you.

* What means "PrintError => 10" in your sample code?
* Isn't PrintError a boolean?
* And doesn't PrintError cause messages from the server to be printed
(to the screen)?
* Does changing that to "PrintError => 0" inhibit the message?

And a suggestion. Please try this:

Insert a pair of raiserror statements into your code, thus:

raiserror( "hello world", 1,1 )
raiserror( "hello error", 18,1 )

Execute the query and see what you see. If you don't see anything, then we
need to look further inside FreeTDS. If you do see output on your screen,
then perl is passing ordinary messages from the server to your screen. In
that event of course you'd want to set up your own handler.

The only thing that confuses me is, the DBD::Sybase change log refers to
suppressing messages with severity < 10 by default back in Release 0.21.
According to that, you won't see such messages (of which "changed database"
is one) *unless* you install an error handler.

Let us know how you fare, and we can go from there.

Regards,

--jkl

> From: Jonathan Hirschi [mailto:jhirschi AT hotmail.com]
> Sent: June 17, 2002 5:50 PM
>
> I started out using 0.53, then upgraded to a cvs snapshot.
> Both versions
> have the same result. I'm using DBD:Sybase 0.93 with Perl 5
> on a solaris 8
> machine. The ms Sql Server 2000 is on a windows 2000
> machine. There is no
> number associated with the output, it is as if it's just
> letting me know.
>
> the output from that test script i sent is below.
>
> # perl test.pl
> Changed database context to 'bugdb'.
> 1 1 jhirschi blah May 29 2002 06:01PM
> 2 1 biggermork blah blah blah blah blah May 29 2002 06:01PM
> 3 1 blah blah blah blah blah blah
> 4 1 blah blah balh blah blah
> 5 1 ashahabi HEAD test2 soldev01.insevo.com NONE test
>
> --------------- snip -----------
>
> Is this a problem with configuration with the sybase driver
> or the database?
> is it not something that freetds is doing? Thanks for the help.
>
> Jon
>
> >John,
> >
> >FreeTDS simply forwards messages from the server to the application
> >(perl/DBD::Sybase in this case). Many applications supress the 5701
> >message, sqsh and DBD::Sybase both do for instance. There
> was an issue on
> >some big endian platforms with TDS 4.2, but IIRC that has
> been fixed for
> >some time. what platform are you running on, are you using
> 0.53 or a CVS
> >snapshot and is there a message number (other than 5701)
> included with the
> >message?
> >
> >Brian
> >
> >On Mon, 17 Jun 2002, Jonathan Hirschi wrote:
> >
> > >
> > > James,
> > >
> > > thanks for your help. I appreciate you taking time to answer my
> >questions.
> > > I am using all of the defaults as far as freetds and
> error handlers are
> > > concerned. I don't have the same problem with other
> drivers (mysql). I
> > > just seem to have this problem in connection with the
> sybase driver and
> > > freetds. the code below always prints out the "Changed
> database context
> >to
> > > bugdb". The configuration for freetds.conf is the
> default configuration
> >for
> > > freetds. I have this same problem no matter whether i
> specify version
> >4.2
> > > or 7.0. There are no error codes being sent out, as far
> as i can see.
> > >
> > > thanks,
> > >
> > >
> > > #!/usr/bin/perl
> > > #
> > > use DBI;
> > >
> > > my $dbh = DBI->connect("dbi:Sybase:server=devdb",
> 'cvsuser', 'test',
> > > {PrintError => 10});
> > >
> > > die "Unable for connect to server $DBI::errstr"
> > > unless $dbh;
> > >
> > > my $rc;
> > > my $sth;
> > >
> > > $sth = $dbh->prepare("select * from tblcvstransaction");
> > > if($sth->execute) {
> > > while(@dat = $sth->fetchrow) {
> > > print "@dat\n";
> > > }
> > > }
> > >
> > >
> > > > > From: Jon Hirschi [mailto:jhirschi AT hotmail.com]
> > > > > Sent: June 17, 2002 3:06 PM
> > > > >
> > > > > Is there any way to turn off the message?
> > > > >
> > > > > the message being sent to the screen is "changed database
> > > > > context to <name>"
> > > >
> > > >Jon,
> > > >
> > > >I checked the message handler (src/ctlib/ctutil.c). No
> writes stderr,
> >no
> > > >printf at all.
> > > >
> > > >Have you set an error handler in your perl code? That
> would be the
> >place
> > > >to
> > > >trap the message (by number) and decide what to print,
> if anything. If
> >you
> > > >have set one, is it being called for other messages,
> just not this one?
> > > >
> > > >Regards,
> > > >
> > > >--jkl
> > >
> > >
> > > _________________________________________________________________
> > > Send and receive Hotmail on your mobile device:
> http://mobile.msn.com
> > >
> > >
> > > ---
> > > 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: [jhirschi AT hotmail.com]
> >To unsubscribe, forward this message to
> >$subst('Email.Unsub')
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> ---
> You are currently subscribed to freetds as: [LowdenJK AT bernstein.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>

---
You are currently subscribed to freetds as: [jhirschi AT hotmail.com]
To unsubscribe, forward this message to $subst('Email.Unsub')


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com





Archive powered by MHonArc 2.6.24.

Top of Page