Hi,
I am receiving the following error when i try to connect to oracle from my php4.2.1/win2k/iis env.
Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in
The code that is giving this error is:
$conn1 = OCINLogon($uname1, $password1, $db1) || die("Error on connection");
$stmt = OCIParse($conn1, "select sysdate from dual");
OCIExecute($stmt, OCI_DEFAULT) || die("Error on execute");
The error is happening after the OCIParse and not after OCINLogon. I tried using the variable strings directly and still it did not work.
Any ideas as to why this could be happening??? Also, I have included the oci dll and mapped it properly in the php.ini.
An early response would be greatly appreciated!!
Thanks alot!!
Oracle Connection error
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You should try using OCIError():
Mac
Code: Select all
$conn1 = OCINLogon($uname1, $password1, $db1) or die('Error on connection<br />'.OCIError());
$stmt = OCIParse($conn1, "select sysdate from dual") or die(OCIError());It is not happening after ociparse, it is telling you it doesn't have a connection to the database.Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in
I trust you have the Oracle client on your php server? and that you can tnsping your database from the command line? and your variables $uname1, $password1 and $db1 contain the correct information. Try using strings rather than variables in your connection, just for testing
OCILogon("user","password","SID");
It take it you need to use OCINLogin because you want to separate transactions, rather than OCILogon.
Thanks twigletmac!!
'||' seemed to be the problem. I tried it with 'or' and it worked with and without the OCIError().
Hopefully, I shouldn't have problem getting my data from oracle now. I've been having a tough time yesterday with all installation errors and today with OCIErrors on which I could hardly find any documentation.
Mikeq, Thanks for your reply but as I mentioned in my post, I had tried your solution earlier.
Thanks!!
'||' seemed to be the problem. I tried it with 'or' and it worked with and without the OCIError().
Hopefully, I shouldn't have problem getting my data from oracle now. I've been having a tough time yesterday with all installation errors and today with OCIErrors on which I could hardly find any documentation.
Mikeq, Thanks for your reply but as I mentioned in my post, I had tried your solution earlier.
Thanks!!