Re: [PHP] Oracle Question
xfedex, yes you can connect to a remote Oracle DB, I'm doing for an app I'm trying to write. You have to configure php with the oracle version you have, more than likely with the --with-oci8=/u1/oracle/product/10g line, of course your oracle location will differ. I chose to use the PEAR::DB to do my oracle stuff instead of the oci calls. This made it simple, and easy to read for me as I'm still learning. The code looks cleaner also. xfedex ([EMAIL PROTECTED]) wrote: > > Hi, > > Can PHP connect to a remote Oracle db? > Because all oracle connecting functions only require 'user' and 'pass' > > http://us3.php.net/manual/en/function.oci-connect.php > http://us3.php.net/manual/en/function.ora-plogon.php > > Thanks, > Regards, > pancarne. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- "Computers are like air conditioners - they stop working properly when you open Windows" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Oracle Question
Yeah, you can connect to Oracle remotely. The standard PHP functions should do it probably, but I've done it using ADODB. I don't know if this is the same on a *nix box, but I was running PHP on a Windows box and needed special Oracle stuff installed on my machine to connect to the Oracle DB. There's a file..something like "tsnames.ora" that has the database information. Sort of like their version of ODBC. You give it an aliased name, then give it all the server info, then when you connect to Oracle, you give it the name that's entered into "tsnames.ora" (or whatever the file is) and the username/password combo. Maybe that'll give you a nudge in the right direction. Good luck! Let us know what you find! -TG = = = Original message = = = Hi, Can PHP connect to a remote Oracle db? Because all oracle connecting functions only require 'user' and 'pass' http://us3.php.net/manual/en/function.oci-connect.php http://us3.php.net/manual/en/function.ora-plogon.php Thanks, Regards, pancarne. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Oracle Question
Hi, Can PHP connect to a remote Oracle db? Because all oracle connecting functions only require 'user' and 'pass' http://us3.php.net/manual/en/function.oci-connect.php http://us3.php.net/manual/en/function.ora-plogon.php Thanks, Regards, pancarne. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Oracle question
Create a sequence, like so CREATE SEQUENCE "WHATEVER_IDS" INCREMENT BY 1 START WITH 1 MAXVALUE 1.0E28 MINVALUE 1 NOCYCLE CACHE 20 NOORDER; then when you insert INSERT INTO test (whatever_ids.nextval); the nice thing is that in your next query you can just do whatever_ids.curval instead of looking up the value with mysql_auto_id or whatever the function is. -Original Message- From: Duy B [mailto:[EMAIL PROTECTED]] Sent: Monday, July 09, 2001 7:36 PM To: [EMAIL PROTECTED] Subject: [PHP] Oracle question Dear all, If i want to use id field in Oracle database, how can i do? For example, in MySQL create table test ( id int not null auto-increment primary key, ten char(10)); So that, when i insert a new row into MySQL database, id increases by 1. But in Oracle i couldn't use as that. Somebody could help me. Thanks you all, BaoDuy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: AW: [PHP] Oracle question
PL/SQL code for an Oracle trigger that will auto-increment specified field: create or replace trigger before insert on for each row begin if :new. is null then select .nextval into :new. from dual; end if; end; You have to create a sequence first. Example: CREATE SEQUENCE INCREMENT BY 1 START WITH -99 MAXVALUE 99 MINVALUE -9 CYCLE CACHE 5 ORDER; Of course, replace values in as needed. If you use the aboce code verbatim, you will a field incrementing from -9... until 9 and then it will begin all over again. -Stathis. Sebastian Stadtlich wrote: > > oracle does not have an autoincrement. > it has the more powerfull concept of TRIGGERS > unfortunatelly you have to write them in pl/sql or java... > have a look on the net for oracle trigger tutorial or > you can > find a super oracle-feature-documentation here : > http://conf.php.net/oci2 > http://conf.php.net/pres/slides/oci/paper.txt > > which features a small non-trigger-work-around > > sebastian > > > -Urspr&oacgr;ngliche Nachricht- > > Von: Duy B [mailto:[EMAIL PROTECTED]] > > Gesendet: Dienstag, 10. Juli 2001 04:36 > > An: [EMAIL PROTECTED] > > Betreff: [PHP] Oracle question > > > > > > Dear all, > > If i want to use id field in Oracle database, how can i do? > > For example, in MySQL > > create table test ( > > id int not null auto-increment primary key, > > ten char(10)); > > > > So that, when i insert a new row into MySQL database, id > > increases by 1. > > > > But in Oracle i couldn't use as that. > > Somebody could help me. > > Thanks you all, > > BaoDuy > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
AW: [PHP] Oracle question
oracle does not have an autoincrement. it has the more powerfull concept of TRIGGERS unfortunatelly you have to write them in pl/sql or java... have a look on the net for oracle trigger tutorial or you can find a super oracle-feature-documentation here : http://conf.php.net/oci2 http://conf.php.net/pres/slides/oci/paper.txt which features a small non-trigger-work-around sebastian > -Ursprüngliche Nachricht- > Von: Duy B [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 10. Juli 2001 04:36 > An: [EMAIL PROTECTED] > Betreff: [PHP] Oracle question > > > Dear all, > If i want to use id field in Oracle database, how can i do? > For example, in MySQL > create table test ( > id int not null auto-increment primary key, > ten char(10)); > > So that, when i insert a new row into MySQL database, id > increases by 1. > > But in Oracle i couldn't use as that. > Somebody could help me. > Thanks you all, > BaoDuy > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Oracle question
Dear all, If i want to use id field in Oracle database, how can i do? For example, in MySQL create table test ( id int not null auto-increment primary key, ten char(10)); So that, when i insert a new row into MySQL database, id increases by 1. But in Oracle i couldn't use as that. Somebody could help me. Thanks you all, BaoDuy