<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >ingres_connect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Ingres II Functions" HREF="ref.ingres.html"><LINK REL="PREVIOUS" TITLE="ingres_commit" HREF="function.ingres-commit.html"><LINK REL="NEXT" TITLE="ingres_cursor" HREF="function.ingres-cursor.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ingres-commit.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ingres-cursor.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ingres-connect" ></A >ingres_connect</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN97983" ></A ><P > (PHP 4 >= 4.0.2, PHP 5 <= 5.0.4)</P >ingres_connect -- Open a connection to an Ingres database </DIV ><DIV CLASS="refsect1" ><A NAME="AEN97986" ></A ><H2 >Description</H2 >resource <B CLASS="methodname" >ingres_connect</B > ( [string database [, string username [, string password [, array options]]]] )<BR ></BR ><P > Returns a Ingres link resource on success, or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ><P > <B CLASS="function" >ingres_connect()</B > opens a connection with the Ingres database designated by <CODE CLASS="parameter" >database</CODE >, which follows the syntax <CODE CLASS="parameter" >[node_id::]dbname[/svr_class]</CODE >. </P ><P > If some parameters are missing, <B CLASS="function" >ingres_connect()</B > uses the values in <TT CLASS="filename" >php.ini</TT > for <CODE CLASS="parameter" >ingres.default_database</CODE >, <CODE CLASS="parameter" >ingres.default_user</CODE > and <CODE CLASS="parameter" >ingres.default_password</CODE >. </P ><P > The connection is closed when the script ends or when <A HREF="function.ingres-close.html" ><B CLASS="function" >ingres_close()</B ></A > is called on this link. </P ><P > All the other ingres functions use the last opened link as a default, so you need to store the returned value only if you use more than one link at a time. </P ><P > <B CLASS="function" >ingres_connect()</B > options <DIV CLASS="informaltable" ><P ></P ><A NAME="AEN98020" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Option name</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >date_century_boundary</TD ><TD >The threshold by which a 2 digit year is determined to be in the current century or in the next century. Equivalent to II_DATE_CENTURY_BOUNDARY. </TD ></TR ><TR ><TD >group</TD ><TD >Speficfies the group ID of the user, equivalent to the '-G' flag</TD ></TR ><TR ><TD >role</TD ><TD >The role ID of the application. If a role password is required, the parameter value should be specified as "role/password"</TD ></TR ><TR ><TD >effective_user</TD ><TD >The ingres user account being impersonated, equivalent to the '-u' flag</TD ></TR ><TR ><TD >dbms_password</TD ><TD >The internal database password for the user connecting to Ingres</TD ></TR ><TR ><TD >table_structure</TD ><TD >The default structure for new tables. Valid values for table_structure are: <P ></P ><UL ><LI ><P >INGRES_STRUCTURE_BTREE</P ></LI ><LI ><P >INGRES_STRUCTURE_HASH</P ></LI ><LI ><P >INGRES_STRUCTURE_HEAP</P ></LI ><LI ><P >INGRES_STRUCTURE_ISAM</P ></LI ><LI ><P >INGRES_STRUCTURE_CBTREE</P ></LI ><LI ><P >INGRES_STRUCTURE_CISAM</P ></LI ><LI ><P >INGRES_STRUCTURE_CHASH</P ></LI ><LI ><P >INGRES_STRUCTURE_CHEAP</P ></LI ></UL > </TD ></TR ><TR ><TD >index_structure</TD ><TD >The default structure for new secondary indexes. Valid values for index_structure are: <P ></P ><UL ><LI ><P >INGRES_STRUCTURE_CBTREE</P ></LI ><LI ><P >INGRES_STRUCTURE_CISAM</P ></LI ><LI ><P >INGRES_STRUCTURE_CHASH</P ></LI ><LI ><P >INGRES_STRUCTURE_BTREE</P ></LI ><LI ><P >INGRES_STRUCTURE_HASH</P ></LI ><LI ><P >INGRES_STRUCTURE_ISAM</P ></LI ></UL > </TD ></TR ><TR ><TD >login_local</TD ><TD >Determines how the connection user ID and password are used when a VNODE is included in the target database string. If set to TRUE, the user ID and password are used to locally access the VNODE and the VNODE login information is used to establish the DBMS connection. If set to FALSE, the process user ID is used to access the VNODE and the connection user ID and password are used in place of the VNODE login information to establish the DBMS connection. This parameter is ignored if no VNODE is included in the target database string. The default is FALSE.</TD ></TR ><TR ><TD >timezone</TD ><TD >Controls the timezone of the session. If not set it will default the the value defined by II_TIMEZONE_NAME. If II_TIMEZONE_NAME is not defined the NA-PACIFIC (GMT-8 with Daylight Savings) is used.</TD ></TR ><TR ><TD >date_format</TD ><TD >Sets the allowable input and output format for Ingres dates. Defaults to the value defined by II_DATE_FORMAT. If II_DATE_FORMAT is not set the default date format is US, e.g. mm/dd/yy. Valid values for date_format are: <P ></P ><UL ><LI ><P >INGRES_DATE_DMY</P ></LI ><LI ><P >INGRES_DATE_FINISH</P ></LI ><LI ><P >INGRES_DATE_GERMAN</P ></LI ><LI ><P >INGRES_DATE_ISO</P ></LI ><LI ><P >INGRES_DATE_ISO4</P ></LI ><LI ><P >INGRES_DATE_MDY</P ></LI ><LI ><P >INGRES_DATE_MULTINATIONAL</P ></LI ><LI ><P >INGRES_DATE_MULTINATIONAL4</P ></LI ><LI ><P >INGRES_DATE_YMD</P ></LI ><LI ><P >INGRES_DATE_US</P ></LI ></UL > </TD ></TR ><TR ><TD >decimal_separator</TD ><TD >The character identifier for decimal data</TD ></TR ><TR ><TD >money_lort</TD ><TD >Leading or trailing currency sign. Valid values for money_lort are: <P ></P ><UL ><LI ><P >INGRES_MONEY_LEADING</P ></LI ><LI ><P >INGRES_MONEY_TRAILING</P ></LI ></UL > </TD ></TR ><TR ><TD >money_sign</TD ><TD >The currency symbol to be used with the MONEY datatype</TD ></TR ><TR ><TD >money_precision</TD ><TD >The precision of the MONEY datatype</TD ></TR ><TR ><TD >float4_precision</TD ><TD >Precision of the FLOAT4 datatype</TD ></TR ><TR ><TD >float8_precision</TD ><TD >Precision of the FLOAT8 data</TD ></TR ><TR ><TD >blob_segment_length</TD ><TD >The amount of data in bytes to fetch at a time when retrieving BLOB/CLOB data, defaults to 4096 bytes when not explicitly set.</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN98135" ></A ><P ><B >Exemplo 1. <B CLASS="function" >ingres_connect()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> $link </font><font color="#007700">= </font><font color="#0000BB">ingres_connect</font><font color="#007700">(</font><font color="#DD0000">"mydb"</font><font color="#007700">, </font><font color="#DD0000">"user"</font><font color="#007700">, </font><font color="#DD0000">"pass"</font><font color="#007700">)<br /> or die(</font><font color="#DD0000">"Could not connect"</font><font color="#007700">);<br /> echo </font><font color="#DD0000">"Connected successfully"</font><font color="#007700">;<br /> </font><font color="#0000BB">ingres_close</font><font color="#007700">(</font><font color="#0000BB">$link</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN98139" ></A ><P ><B >Exemplo 2. <B CLASS="function" >ingres_connect()</B > example using default link </B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> ingres_connect</font><font color="#007700">(</font><font color="#DD0000">"mydb"</font><font color="#007700">, </font><font color="#DD0000">"user"</font><font color="#007700">, </font><font color="#DD0000">"pass"</font><font color="#007700">)<br /> or die(</font><font color="#DD0000">"Could not connect"</font><font color="#007700">);<br /> echo </font><font color="#DD0000">"Connected successfully"</font><font color="#007700">;<br /> </font><font color="#0000BB">ingres_close</font><font color="#007700">();<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.ingres-pconnect.html" ><B CLASS="function" >ingres_pconnect()</B ></A > and <A HREF="function.ingres-close.html" ><B CLASS="function" >ingres_close()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ingres-commit.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ingres-cursor.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ingres_commit</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ingres.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ingres_cursor</TD ></TR ></TABLE ></DIV ></BODY ></HTML >