note 43335 added to function.ocilogon
| From: | william_poulsen at hotmail dot com | Date: | Thu, 17 Jun 2004 20:00:11 +0000 |
| Subject: | note 43335 added to function.ocilogon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71245@lists.php.net to get a copy of this message | ||
If you are trying to do an Oracle query from the command line you may need to manually configure
ORACLE_SID. If, for example, you want the server to generate emails based on the contents of some
tables you can setup a cron job to run your PHP script as opposed to requiring somebody to go to the
page in a browser. From a PHP script within a browser you can do something like the following
because the TSANames are configured within Apache...
<?php
$db = "DBNAME";
$odbc = ocilogon ('USER', 'PASS', $db) or die( "Could not connect to Oracle
database!");
if ($odbc == false){
$msg = OCIError($odbc)."<BR>";}
?>
From a commandline script you have to change the $db variable as follows...
#!/path/to/commandline/php
<?php
$db ="(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = HOSTNAMEHERE)
(PORT = 1521)
)
(CONNECT_DATA = (SID = SIDNAMEHERE))
)";
$odbc = ocilogon ('user', 'pass', $db) or die( "Could not connect to Oracle
database!") or die (ocierror());
?>
----
Manual Page -- http://www.php.net/manual/en/function.ocilogon.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43335
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43335&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43335&report=yes
Search -- http://master.php.net/manage/user-notes.php