php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7370 sybase and php connection
Submitted: 2000-10-20 13:25 UTC Modified: 2000-12-07 11:56 UTC
From: tomcwh at bigfoot dot com Assigned:
Status: Closed Package: Sybase-ct (ctlib) related
PHP Version: 4.0.3pl1 OS: WINNT, WIN98
Private report: No CVE-ID: None
 [2000-10-20 13:25 UTC] tomcwh at bigfoot dot com
see below

Tom,
Since you are using the "sa" user to connect to Sybase, Sybase is
automatically moving you to the Master DB. This is because the "sa" 
user is
used almost exclusively for administrative tasks covering all of the
databases.  But then PHP trys to connect in the database you specified.  
And
Sybase is confused because you are not in that database.
I think if you create another user (beside sa), under the database you 
are
trying to connect to you should not have any more problems.

Hope this helps,
Terry

> -----Original Message-----
> From: Tom [mailto:tomcwh@yahoo.com]
> Sent: Monday, October 16, 2000 1:37 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] sybase and php
>
>
> I have a problem when using php to connect ASE via
> OpenClient.
> But I dont know where would be appropriate for me to
> post this
> message. Anyway, I did, sorry for any inconvenience
> caused.
>
> I configured a machine with php, pws and open client.
> Then the php
> scripting engine seems working fine. And then I
> created a file named
> "sybase.php" to test the connection between the php,
> open client and
> ASE.
> However, the return shows that there is something
> wrong with the ASE.
> Afterward, I searched the manuals.sybase.com almost
> entirely for an
> answer about the error message. But I got nothing,
> would someone can
> help to me to solve it. Thanks.
>
> The following shows that content of the sybase.php
>
> <?php
> $connect=sybase_connect("TEST","sa", "") or
> die ("Could not connect to the sybase server!");
> $selectdb=sybase_select_db("mydb",$connect) or die
> ("could not select db");
> $clssybase=sybase_close($connect) or die
> ("Cound not close sysbase database server");
> ?>
>
> The following shows the content of the error message.
>
> Warning: Sybase: Server message: Changed database
> context to 'master'.
> (severity 10, procedure N/A) in
> D:\Inetpub\wwwroot\cgi-bin\sybase.php on
> line 4
> PHP has encountered an Access Violation at 01FA03B3
>
> Thomas
>
> =====
> Tom
> mailto:tomcwh@bigfoot.com
>
>

On Mon, 16 Oct 2000 09:42:06 +0800, Thomas <tomcwh@bigfoot.com> wrote:

Guessing but I suspect you have the wrong calling convention for the 
Sybase error message handler and the stack becomes corrupted in the call 
to the message handler.

The calling convention for openclient called functions is __stdcall.
So the error message handlers are defined like this:

CS_RETCODE CS_PUBLIC client_handlers(... etc ...)  
on the NT platfrom CS_PUBLIC is defined : #define CS_PUBLIC __stdcall

This allows you to use whatever calling convention you want in your 
program but assures that the error handler  will be calling properly.  Use 
this calling convention for both the client  and the server message 
callback() functions.

Jay

>I have a problem when using php to connect ASE via OpenClient.
>But I dont which newsgroup that would be appropriate for me to post 
this
>message. Anyway, I did, sorry for any inconvenience caused.
>
>I configured a machine with php, pws and open client. Then the php
>scripting engine seems working fine. And then I created a file named
>"sybase.php" to test the connection between the php, open client and
>ASE.
>However, the return shows that there is something wrong with the ASE.
>Afterward, I searched the manuals.sybase.com almost entirely for an
>answer about the error message. But I got nothing, would someone can
>help to me to solve it. Thanks.
>
>The following shows that content of the sybase.php
>
><?php
>$connect=sybase_connect("TEST","sa", "") or
>die ("Could not connect to the sybase server!");
>$selectdb=sybase_select_db("mydb",$connect) or die
>("could not select db");
>$clssybase=sybase_close($connect) or die
>("Cound not close sysbase database server");
>?>
>
>The following shows the content of the error message.
>
>Warning: Sybase: Server message: Changed database context to 'master'.
>(severity 10, procedure N/A) in D:\Inetpub\wwwroot\cgi-bin\sybase.php 
on
>line 4
>PHP has encountered an Access Violation at 01FA03B3
>
>Thomas
>mailto:tomcwh@bigfoot.com
>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-01 00:53 UTC] joey@php.net
"Terry"s comments are completely unrelated...

Is there any change if you effect the following change?

$selectdb=sybase_select_db("mydb",$connect) 

to

sybase_select_db("mydb",$connect) 
 [2000-12-07 11:56 UTC] sniper@php.net
No feedback.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC