Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: db2_conn_error - Manual
[go: Go Back, main page]

PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<db2_commitdb2_conn_errormsg" width="11" height="7"/>
view the version of this page
Last updated: Sun, 07 May 2006

db2_conn_error

(PECL)

db2_conn_error --  直近の接続から返された SQLSTATE を含む文字列を返す

説明

string db2_conn_error ( [resource connection] )

db2_conn_error() は、データベースへの直近の接続が 失敗した原因を表す SQLSTATE を返します。接続が失敗した場合には、 db2_connect()FALSE を返します。 この場合、SQLSTATE の値を取得するために db2_conn_error() に何もパラメータを渡す必要はありません。

しかし、接続は成功したもののその後に無効になった場合は、 パラメータ connection を指定することで 特定の接続についての SQLSTATE を取得することができます。

SQLSTATE の値の意味を調べるには、DB2 コマンドラインプロセッサのプロンプトで 次のコマンドを発行します。 db2 '? sqlstate-value' また、db2_conn_errormsg() をコールして、 明示的なエラーメッセージと、それに関連する SQLCODE の値を取得することも可能です。

パラメータ

connection

当初は成功したものの、その後に無効になった接続に 関連付けられた接続リソース。

返り値

失敗した接続試行の結果を表す SQLSTATE を返します。 直近の接続試行に関連するエラーがない場合には空の文字列を返します。

例 1. 失敗した接続試行からの SQLSTATE の取得

以下の例では、db2_connect() に わざと無効なパラメータを渡し、SQLSTATE を取得しています。

<?php
$conn
= db2_connect('badname', 'baduser', 'badpassword');
if (!
$conn) {
   print
"SQLSTATE の値: " . db2_conn_error();
}
?>

上の例の出力は以下となります。

SQLSTATE の値: 08001



add a note add a note User Contributed Notes
db2_conn_error
There are no user contributed notes for this page.

<db2_commitdb2_conn_errormsg" width="11" height="7"/>
 Last updated: Sun, 07 May 2006
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2006 The PHP Group
All rights reserved.
This mirror generously provided by: PacketBusiness, Inc.
Last updated: Mon Sep 4 13:20:40 2006 JST