<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.maxdb-real-connect"> <refnamediv> <refname>maxdb_real_connect</refname> <refname>maxdb::real_connect</refname> <refpurpose>Opens a connection to a MaxDB server</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>&style.procedural;</para> <methodsynopsis> <type>bool</type><methodname>maxdb_real_connect</methodname> <methodparam><type>resource</type><parameter>link</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>hostname</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam> <methodparam choice='opt'><type>int</type><parameter>port</parameter><initializer>0</initializer></methodparam> <methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam> </methodsynopsis> <para>&style.oop;</para> <methodsynopsis> <type>bool</type><methodname>maxdb::real_connect</methodname> <methodparam choice='opt'><type>string</type><parameter>hostname</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam> <methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam> <methodparam choice='opt'><type>int</type><parameter>port</parameter><initializer>0</initializer></methodparam> <methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam> </methodsynopsis> <para> <function>maxdb_real_connect</function> attempts to establish a connection to a MaxDB database engine running on <parameter>hostname</parameter>. </para> <para> This function differs from <function>maxdb_connect</function>: </para> <itemizedlist> <listitem> <para> <function>maxdb_real_connect</function> needs a valid resource which has to be created by function <function>maxdb_init</function> </para> </listitem> <listitem> <para> With function <function>maxdb_options</function> you can set various options for connection. </para> </listitem> </itemizedlist> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* create a connection object which is not connected */ $maxdb = maxdb_init(); /* set connection options */ $maxdb->options(MAXDB_UNICODE, "FALSE"); $maxdb->options(MAXDB_TIMEOUT, 5); /* connect to server */ $maxdb->real_connect('localhost', 'MONA', 'RED', 'DEMODB'); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s\n", maxdb_connect_error()); exit(); } printf ("Connection: %s\n.", $maxdb->host_info); $maxdb->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* create a connection object which is not connected */ $link = maxdb_init(); /* set connection options */ maxdb_options($link, MAXDB_UNICODE, "FALSE"); maxdb_options($link, MAXDB_TIMEOUT, 5); /* connect to server */ maxdb_real_connect($link, 'localhost', 'MONA', 'RED', 'DEMODB'); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s\n", maxdb_connect_error()); exit(); } printf ("Connection: %s\n.", maxdb_get_host_info($link)); maxdb_close($link); ?> ]]> </programlisting> </example> &example.outputs.similar; <screen> <![CDATA[ Connection: localhost <...> ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>maxdb_connect</function></member> <member><function>maxdb_init</function></member> <member><function>maxdb_options</function></member> <member><function>maxdb_ssl_set</function></member> <member><function>maxdb_close</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"~/.phpdoc/manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->