PHP Velho Oeste 2024

sybase_pconnect

(PHP 4, PHP 5)

sybase_pconnectSybase の持続的な接続をオープンする

警告

この機能は PHP 7.0.0 で 削除 されました。

説明

sybase_pconnect ([ string $servername [, string $username [, string $password [, string $charset [, string $appname ]]]]] ) : resource

sybase_pconnect() は、2 つの違いを除いて sybase_connect() と全く同様に動作します。

まず、接続時にこの関数は最初同じホスト、ユーザー名、パスワードで オープンされた(持続的)リンクを見つけようとします。 見つかった場合、新しい接続をオープンする代わりにこれに関する ID が返されます。

第二に、SQL サーバーへの接続はスクリプト実行終了時にクローズされません。 代わりに、このリンクは将来的に使用するためにオープンされたままに なります(sybase_close() は、 sybase_pconnect() により確立されたリンクを 閉じません)。

このため、この型のリンクは'持続的'と呼ばれます。

パラメータ

servername

引数 servername は、'interfaces' ファイル中で定義された 有効なサーバー名である必要があります。

username

Sybase のユーザー名。

password

username のパスワード。

charset

接続に使用する文字セットを指定します。

appname

Sybase 接続用の appname を指定します。 これにより、ひとつのスクリプトから同じデータベースに複数の接続を行えるようになります。 現在の接続でトランザクションを開始し、 トランザクション内では実行できない別のクエリを実行したい場合などに便利です。

返り値

成功時に正の Sybase 持続リンク ID を、エラー時に FALSE を返します。

参考

add a note add a note

User Contributed Notes 1 note

up
1
verdy_p at wanadoo dot fr
24 years ago
The servername specified in sybase_connect and sybase_pconnect is solved locally on the PHP3 server host, which should be configured with the appropriate Sybase client configuration. This includes setting the environment variables for the account that runs the PHP3 extension, i.e. if it runs as a Web server extension, it must be configured in the user account that runs the Web server. You may setup at least the SYBASE environment, and add $SYBASE/bin within the user's path that runs the Web server. Standard installations of Sybase clients include setting up either a $SYBASE/interfaces file under Unix, or %SYBASE%\ini\sql.ini under Windows. This file contains local aliasnames for the referenced server names. These names may be different than that really used on the host that run the Sybase SQL Server. What is important is that this Sybase client configuration file will specify the location of the SQL Server, i.e. the network protocol to use, and if it's through TCP/IP, the host name or IP address of the Sybase SQL Server host, and its listener port number. Newer versions of Sybase includes the option to setup the interfaces or SQL.INI file with a single server entry, with will be a Sybase naming service. If this is used, the Sybase OpenClient libraries will connect to this naming service, if the SERVER name specified can't be solved locally. This naming service will provide the SQL Server location for the specified SERVER name you use in the sybase_connect or sybase_pconnect function calls, allowinf naming resolution on sites that want to have a centralized administration of multiple Sybase OpenServer servers, including gateways to other SQL servers such as OpenServer compatible gateways to Oracle or Informix servers. But if you want faster accesses to your Sybase SQL server used by your PHP3 scripts, you should configure the host which runs the PHP3 extension so that servernames can be solved locally. All you need is to add server entries in your interfaces or SQL.INI Sybase OpenClient configuration file.
To Top