maxdb_real_connect,とは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > maxdb_real_connect,の意味・解説 

maxdb_real_connect,

(PECL)
maxdb_real_connect, maxdb->real_connect — MaxDB サーバへの接続をオープンする

説明

手続き型
bool maxdb_real_connect ( resource link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket]]]]]] )
オブジェクト指向型 (メソッド)
class maxdb {
bool real_connect ( [string hostname [, string username [, string passwd [, string dbname [, int port [, string socket]]]]]] )
} maxdb_real_connect() は、 hostname で稼動中の MaxDB データベースエンジンに対して、 接続の確立を試みます。
この関数は、maxdb_connect() とは以下の点で違います。
  • maxdb_real_connect() には、 maxdb_init() で作成した有効なリソースが必要です。
  • maxdb_options() 関数により、 接続の際のさまざまなオプションを設定することが可能です。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

参考

maxdb_connect(), maxdb_init(), maxdb_options(), maxdb_ssl_set(), maxdb_close().

例 1139. オブジェクト指向型
<?php

/* 接続オブジェクトを作成しますが、まだ接続していません */
$maxdb = maxdb_init();

/* 接続オプションを設定します */
$maxdb->options(MAXDB_UNICODE, "FALSE");
$maxdb->options(MAXDB_TIMEOUT, 5);

/* サーバに接続します */
$maxdb->real_connect('localhost', 'MONA', 'RED', 'DEMODB');

/* 接続を調べます */
if (maxdb_connect_errno()) {
   printf("接続に失敗しました: %s\n", maxdb_connect_error());
   exit();
}

printf ("接続: %s\n.", $maxdb->host_info);

$maxdb->close();
?>

例 1140. 手続き型
<?php

/* 接続オブジェクトを作成しますが、まだ接続していません */
$link = maxdb_init();

/* 接続オプションを設定します */
maxdb_options($link, MAXDB_UNICODE, "FALSE");
maxdb_options($link, MAXDB_TIMEOUT, 5);

/* サーバに接続します */
maxdb_real_connect($link, 'localhost', 'MONA', 'RED', 'DEMODB');

/* 接続を調べます */
if (maxdb_connect_errno()) {
   printf("接続に失敗しました: %s\n", maxdb_connect_error());
   exit();
}

printf ("接続: %s\n.", maxdb_get_host_info($link));

maxdb_close($link);
?>

上の例の出力は、たとえば以下のようになります。

接続: localhost <...>

    



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「maxdb_real_connect,」の関連用語

maxdb_real_connect,のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



maxdb_real_connect,のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2025 by the PHP Documentation Group.

©2025 GRAS Group, Inc.RSS