Skip to Content.
Sympa Menu

freetds - Re: AW: [freetds] Connect to Sybase ASA 8 with pear:DB

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: AW: [freetds] Connect to Sybase ASA 8 with pear:DB
  • Date: Mon, 14 Jun 2004 07:15:28 -0400

On Mon, 14 Jun 2004, "Florian Kornhoffer" <f.kornhoffer AT laufwerk.de>
wrote:
>
> >>You have an ASA server. I don't use PHP, but it looks like you're
> >using
> the sybase extension. Your server needs an entry in freetds.conf, and
> the name of that entry must be the ASA database you want to connect to
> ('testdb'). ... <<
>
> thanks for your help - I got a bit further now - but still I'm not
> successfull. Here's what happens now:
>
> my testdb.php:
> <?php
> //DB-Modul laden
> require_once "DB.php";
>
> //setzen der variablen für connect
> $dsn = array(
> 'phptype' => 'sybase',
> 'username' => 'dba',
> 'password' => 'xyz',
> 'hostspec' => 'DBX',
> 'database' => 'testdb',
> );
>
> //connect
> $db =& DB::connect($dsn);
> if (DB::isError($db)) {
> die($db->getMessage());
> }
>
> freetds.conf:
> [global]
> tds version = 4.2
> [DBX]
> host = 62.153.x.x
> port = 2638
> tds version = 5.0
>
>
> My result now:
> Warning: sybase_connect(): Sybase: Server message: ASA Fehler -83:
> Angegebene Datenbank nicht gefunden <<my translation: named database not
> found>> (severity 16, procedure N/A) in /usr/local/lib/php/DB/sybase.php
> on line 55
...
> If I understand that the right way, there now is a connection to the
> sybase server itself, but the database 'testdb' itself is not found?

Ja, hast du recht.

> What are possible causes for that?

The reason is that FreeTDS passes the servername string 'DBX' to the
server in a field of the login record. Most servers don't pay much
attention to that field, but ASA servers interpret it as a database name.
FreeTDS is (in effect) asking your server to open a database called 'DBX'.
(Of course, that would be clearer if the error message stated which
database was "nicht gefunden". But then it would be too easy, wouldn't
it?)

Try this instead:

$dsn = array(
'phptype' => 'sybase',
'username' => 'dba',
'password' => 'xyz',
'hostspec' => 'testdb',
'database' => 'testdb',
);

and:

freetds.conf:
[global]
tds version = 4.2
[testdb]
host = 62.153.x.x
port = 2638
tds version = 5.0

Hope that helps.

Regards,

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page