SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sybase error messages...

    Right, just before hand, this is my first time with Sybase, so please be patient with me

    I managed to install, create a new database and insert data into Sybase using the Sybase Central Java Edition utility jisql.

    But, if i try to connect to the DB using PHP i get the following error messages

    Warning: Sybase: Server message: Changed database context to 'master'. (severity 10, procedure N/A) in g:\apache_web\intern\cms\SyDatabase.php on line 61

    Warning: Sybase: Server message: Changed database context to 'users'. (severity 10, procedure N/A) in g:\apache_web\intern\cms\SyDatabase.php on line 63

    And here's the code affected (using the Eclipse Library)
    PHP Code:
        function connect($username$password$type ECLIPSE_DB_NON_PERSISTENT
        {
            
    $this->setLink(
                (
    $type == ECLIPSE_DB_PERSISTENT)
                    ? 
    sybase_pconnect($this->getHost(), $username$password)
                    : 
    sybase_connect($this->getHost(), $username$password//LINE NUMBER 61
            
    );
            
    sybase_select_db($this->getName(), $this->getLink()); //LINE NUMBER 63
            
    return $this->isConnected();
        } 
    Does anybody know why i get these error messages?

    Maybe i did something wrong when creating the database in jisql?

    Thanks a lot in advance for ANY help!

    Best regards from Vienna,
    datune

  2. #2
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is ASE telling PHP that you were once in database master (the default if you do not set one) then Eclipse is issuing a 'USE users' command to again switch databases. PHP treats it as a warning since it doesn't handle it correctly.

    The easiest method to hide it is to temporarily suppress warnings, e.g.

    PHP Code:
    <?

    error_reporting
    E_ERROR );

            
    $this->setLink
                (
    $type == ECLIPSE_DB_PERSISTENT
                    ? 
    sybase_pconnect($this->getHost(), $username$password
                    : 
    sybase_connect($this->getHost(), $username$password//LINE NUMBER 61 
            
    ); 

    error_reportingE_ERROR E_WARNING E_PARSE );

    ?>
    There is a php.ini setting to do this for you in the Sybase section (something like Sybase_Min_Severity) but that code should work.

    Also, it is not efficient to pop in and out of databases like that.

    In isql log in as you web account (sa?) and issue:
    sp_modifylogin <your login name>, "defdb", "users"

    Then comment out the change DB code since it is now wasteful to issue it on each connect (unless you change DB contexts often).

  3. #3
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah i see, well, i don't really want to suppress errors, cause i believe they are there for a reason.

    So, i went into jisql and entered the following as you proposed

    sp_modifylogin sa, "master", "users"

    And i commented the line 63 out (see first post), but i still get the following error message, which is the same as before

    Warning: Sybase: Server message: Changed database context to 'master'. (severity 10, procedure N/A) in g:\apache_web\intern\cms\SyDatabase.php on line 61

    Any ideas as to why Mattr?

  4. #4
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're not suppressing errors, just the warnings on connect that PHP interprets from Sybase. The second error_reporting command re-sets the error level so you will see warnings again.

    Enter the command EXACTLY as I had it, e.g.
    sp_modifylogin sa, "defdb", "users"

  5. #5
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, sorry i should have read your post more carefully, i sort of overlooked the part where you said that it is actually PHP's fault and not mine.

    Also the command worked now, i thought i had to replace the defdb with whatever i thought would be the def DB

    Anyhow, it works, thanks a lot Mattr


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •