RE: [PHP-WIN] Oh what a fool I am (Oracle/PHP connection)

From: Date: Fri, 03 Nov 2000 16:17:07 +0000
Subject: RE: [PHP-WIN] Oh what a fool I am (Oracle/PHP connection)
Groups: php.windows 
Request: Send a blank email to php-windows+get-3672@lists.php.net to get a copy of this message
Just wanted to pass on another piece of info concerning the Oracle SID. When I setup the Oracle 8.6.1 client on our WinNT SP6 it appended our domain to the name of each tnsnames.ora entry. For example, MYSID.WORLD was created as MYSID.KELLY.AF.MIL. So in PHP the connection sid became MYSID.KELLY.AF.MIL. Ron Woods/GAI Sr. Software Engineer 1777 N.E. Loop 410 Suite 600 San Antonio, TX 78217 Tel: 210-820-2615 Fax: 210-832-0487 http://www.gai-inc.com -----Original Message----- From: Andy Hoffman [mailto:andy.hoffman@bms.com] Sent: Friday, November 03, 2000 9:25 AM To: Vince LaMonica; Mustafa SARI; jasendorf@lcounty.com Cc: php-windows@lists.php.net Subject: [PHP-WIN] Oh what a fool I am (Oracle/PHP connection) Folks, A bright new light has dawned in the "figuring out how to use oci8 & php". For a while, Vince and I have been helping folks get oci8 working under php4... well, all that time, I was maintaining that the php oci8 connection call (ocilogon or ociplogon) had to be made with the following syntax (based on the php manual, of course): ocilogon("<username>", "<passwd>", "<SID>"); Replacing the username, password and SID, of course, to match those specified in Net8 Assistant and the database server. However, that's not quite right... and this was brought to light by the good fortune of Mustafa Sari (a student in Portugal whom I was assisting this week). We were having the hardest time getting his Oracle 8.1.6 client to connect within PHP, and one of the reasons, I thought, was because his Service Name (left hand tree-view in Net8 Assistant) did not match the specified SID for that particular database instance. I previously figured that the Service Name prefix (mysid in mysid.world, for instance) MUST match the SID (MYSID for this example) specified using Release 8.0 Compatibility. Well, from what Mustafa discovered today... 1) the Service Name in the left panel does not necessarily have to match the specified SID, and more importantly 2) the name used by ocilogon (what was previously noted as SID) is in fact the service name prefix and NOT the SID. Here's two examples of tnsnames.ora files to demonstrate what I'm getting at (connection code to follow)... #1 - Service Name prefix matches SID MYSID.WORLD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = someserver.mycompany.com) (PORT = 1521)) ) (CONNECT_DATA = (SID = MYSID) ) ) #2 - Service Name prefix different than SID TEST.WORLD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = someserver.mycompany.com) (PORT = 1521)) ) (CONNECT_DATA = (SID = MYSID) ) ) In example #1, which was the previous "only works this way" recommendation, the correct connection call would look like: ocilogon("scott","tiger","MYSID"); ... which looked like the normal way of connecting via an SID, right? Well, for example #2, you would only be able to connect successfully via this connection call: ocilogon("scott","tiger","TEST"); And thus the discovery that indeed, ocilogon calls within PHP are made using the Service Name prefix, and NOT the SID. Test it and see for yourself, but we're definitely chalking this one up as one of the trickier tricks in the OCI8 wars. Just thought you all might like to know about it. And if anyone finds anything different, or if I'm just blowing smoke, let me know. Vince, this is definitely one for the How-to... and thanks, Mustafa! You definitely made my morning :) -- Andy Hoffman Web Developer Bristol-Myers Squibb email: andy.hoffman@bms.com -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#3672) next »