Connecting oracle with php

hi all,
i am using Xammp 1.7.4, PHP version 5.3.5, apache 2.2, and oracle 11g. actually i know how to connect MySql using php, but now i am trying to connect oracle using php. Can any 1 tell me the clear cut steps to do the same ?

You need to add the right oci8 DLL or .so to php.ini and make sure it has access to Oracle client libraries. These Oracle libraries are from an Oracle Home or Oracle Instant Client.
Without knowing your platform and whether the Oracle DB is on the same machine as Xampp the best place to start is to look at
http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

Similar Messages

  • Connect Oracle with AS400

    Iam new in this , what I need, for connect Oracle with AS400...? someone Can Help me please.....
    Thanks!!!

    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/integrat.htm#sthref3364

  • How connect Oracle with AS400?

    Hi!
    I don´t know how i can connect oracle with AS400 , what I need for make the connection?

    Hi,
    You have 3 options:
    - Oracle Transparant Gateway for DRDA
    This product is available for Windows, Linux, AIX, HP-UX PA-RISC and Solaris SPARC
    It uses the IBM DRDA protocol (over TCP/IP) to establish a connection with DB2400
    - Oracle Transparant Gateway for DB2/400
    This product needs to be installed on the AS/400
    - Generic Connectivity (aka HSODBC)
    This is a default Oracle Database feature that is available for Windows, Linux x86,
         AIX, HP-UX PA RISC and Solaris Sparc.
         In addition it requires a suitable ODBC-Driver (32-bit) that is able to connect to
         DB2/400
    The gateways require additional license from Oracle, while HSODBC requires additional license for a third party ODBC vendor. Furthermore do gateways support the two phase commit protocol and calling DB2/400 stored procedures.
    Regards,
    Ed
    DRDA over TCP/IP
    Message was edited by:
    ebangma

  • Not able to connect Oracle through PHP

    Hello All ,
    I am trying to connect Oracle DB through PHP script . But I am not able to do so .
    My code is :
    <?php
    echo "PRASHANT" ;
    include 'include/odb.php';
    include 'include/ReadConfig.php';
    $conn=OrclConnect('orcl');
    $conn->SetFetchMode(ADODB_FETCH_BOTH);
    echo "DWIVEDI" ;
    ?>
    But when I ran this script throgh command prpmpt , I am getting the first echo message .. But not the last one ( echo "Dwivedi") .
    I am not able to connect Oracle DB through this script .
    Please some one help me out where I am wrong with script .
    Thanks
    Prashant Dwivedi

    Below is my source code
    <?php
    $ORACLE_HOME = 'D:\\oracle\\product\\10.2.0\\parag';
    $ORACLE_SID = 'parag';
    $LD_PRELOAD ='';
    $LD_LIBRARY_PATH ='';
    $TNS_ADMIN = 'D:\\oracle\\product\\10.2.0\\parag\\NETWORK\\ADMIN';
    $NLS_LANG = 'AMERICAN_AMERICA.WE8MSWIN1252';
    $username='spd';
    $password='spd';
    $db='(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = parag)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = parag)))';
    echo "here1";
    echo "$TNS_ADMIN";
    $conn = oci_connect($username,$password,$db);
    echo "$ORACLE_HOME";
    if (!$conn) {
    $e = oci_error();
    print htmlentities($e[' message']);
    exit;
    ?>
    But still i am getting the same error message

  • Oracle with php

    i am new to oracle and i want to know how would i access (read / write) to a oracle database using php.
    if someone can point me into the direction to look.
    thanks

    before you get your feet wet with using oci functions in PHP, run a script with just one line :-
    <?phpinfo()?>
    save it as, say TEST.PHP and then view it in your browser. this generates a page, which lists out all the compiled environments. if you dont see a section called OCI8, then i guess you havent compiled your PHP properly.
    cheerio!! Hi
    I did that and everything is ok. I get php infos and oci8 is well installed.
    But, when i try to connect (oracle 8.0.5), like this :
    $connection = OCILogon ("scott","tiger");
    I get : "Warning: _oci_open_server. Error while trying to retrieve
    text for error ORA-12546 in /var/www/..."
    I tried too with :
    $connection = OCILogon ("scott","tiger","ora8");
    In this case, i get an error ORA-12154.
    My tnsnames.ora is ok (i can connect from sqlplus without problems.
    I tried to add to my script instructions done for inializing the environnement (with "putenv") for the main oracle variables necessary to connect (ORACLE_HOME, TNS_ADMIN, etc).
    I don't see anything else.
    Does anybody know this problem? Or (better) could help?
    Thanks
    Rosaire AMORE

  • How to connect oracle with ms access database

    Dear
    We are on release r12, right now we have requirement to connect oracle database with ms access to get some information. We have found gateway(Heterogeneous services) using ODBC, but at the database side where is installed oracle r12 there is no installed ms access software becuse of linux operating system, so how could it will connect ms access because without installing ms-access we are unable to find ms ODBC gateway in ODBC driver under the control panel.
    Can any body guide me how could achieve this
    Edited by: oracle0282 on Sep 21, 2011 12:47 AM

    If I understand you correctly you want to access Oracle on Linux from MS-Access (possible on Windows only). You need neither a gateway nor Heterogeneous Services, but an Oracle client including ODBC driver (Instant client with ODBC driver is enough) on the Windows machine.
    Configure the ODBC driver with the connect informations to the Oracle server.
    Werner

  • Error in Remote Connect Oracle with MTS Mode

    I've configed my database to run MTS.
    My db is 8.1.5 with x86 Unix SunOS 5.7
    If I connect db through local area network, I can connect it with MTS mode.
    But if I try to connect db from a remote site, I can't connect and the following error shown :
    ERROR:
    ORA-12545: Connect failed because target host or object does not exist
    By adding a clause (SERVER = DEDICATED) in my remote client's tnsnames.ora
    I can connect it.
    Rgds,
    Edward
    The following is my configuration.
    init.ora :
    mts_dispatchers = "(PROTOCOL=TCP)(DISP=3)"
    mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
    mts_servers = 1
    mts_max_servers = 40
    mts_max_dispatchers = 4
    listener.ora :
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = QQQQdb)(PORT = 1521))
    (DESCRIPTION =
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    (ADDRESS = (PROTOCOL = TCP)(HOST = QQQQdb)(PORT = 2481))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u01/app/oracle/product/8.1.5)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = QQQQdb.net)
    (ORACLE_HOME = /u01/app/oracle/product/8.1.5)
    (SID_NAME = QQQQdb)
    tnsnames.ora :
    QQQQDB =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = QQQQdb)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = QQQQdb.net)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    null

    I have run into the same problem using oracle 8.1.6.1 with redhat 6.2..
    I have found out that only when I specify host ip in the mts_dispatchers the mts will work correctly..(specifying host domain name is no use)
    Here is a sample of the configuration, hope that helps..
    mts_dispatchers = "(address=(protocol=tcp)(host=192.168.0.1))(dispatchers=4)"

  • How to connect  oracle with c++

    i wanted to know that how should i connect oracle to c++.
    kindly list me the commands which i need to write to access database fro oracle.
    thanks ...

    If you're attempting to use the ODBC API directly, have you downloaded the ODBC SDK from Microsoft? That will include some sample code, which is a great starting point. So far as I'm aware, you shouldn't need to configure anything in Borland C++ that you don't have to configure in any other C++ compiler to use ODBC.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to connect Oracle with Jsp?

    Hi,
    I am student and I am trying to use Jsp to connect oracle. Do you have any sample to show how to do it?
    Thanks a lot.
    Amy

    In JSP, you connect to the Oracle in a same way as you would do it in any Java application, using JDBC. Please refer to Java Tutorial -> JDBC on sun site and you will get easy and straight forward concepts.

  • Connecting flex with php(wamp)

    i m trying to connect a flex application to a php (wamp server)..bt i m unable to do soo
    ma application runs fine....bt wen i click submit button it shows ..transfering data frm localhost n nothing happens......database is nt updated........
    //flex code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="send_data()">
    <mx:Script>
    <![CDATA[
    import mx.controls.DataGrid
    private function send_data():void {
    userRequest.send();
    ]]>
    </mx:Script>
    <mx:Label x="79" y="89" text="username"/>
    <mx:Label x="79" y="128" text="rolnumber"/>
    <mx:TextInput id="nm" x="153" y="87"/>
    <mx:TextInput x="153" y="126" id="roll"/>
    <mx:Button x="127" y="191" label="submit" id="sub" click="send_data()"/>
    <mx:HTTPService id="userRequest" url="http://localhost/connect.php" useProxy="false" method="POST">
    <mx:request xmlns="">
    <username>{nm.text}</username><rollnumber>{roll.text}</rollnumber>
    </mx:request>
    </mx:HTTPService>
    </mx:Application>
    //php code
    <?php
    mysql_connect("localhost", "root", "") or die("cannot connect");
    mysql_select_db("std_db") or die("cannot select database");
    $q="INSERT INTO `std_db`.`student` (`name` ,`roll`)VALUES ( '$_POST[nm]', $_POST[roll])";
    if(mysql_query($q))
    echo "sucessfully inserted";
    else
    echo" error occured";
    //if($row=mysql_fetch_array($result))
    //echo $row['
    ?>

    naval joshi wrote:
    thanx a lot it worked........wat shd be the code fr display full datbasee nnnnnnshd i usee the datagrid?
    you can use a datagrid if you want, or a tile list, or a list, or an advanced datagrid, it's entirely up to you and what you plan to do with the data.
    The Full working basic code for what you're trying to do is this:
    Flex code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="send_data()">
        <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.controls.DataGrid
            private function send_data():void
                userRequest.send();
            private function handleResult(evt:ResultEvent):void
                dg1.dataProvider = evt.result.player;
        ]]>
        </mx:Script>
        <mx:Label x="79" y="89" text="username"/>
        <mx:Label x="79" y="128" text="rolnumber"/>
        <mx:TextInput id="nm" x="153" y="87"/>
        <mx:TextInput x="153" y="126" id="roll"/>
        <mx:Button x="127" y="191" label="submit" id="sub" click="send_data()"/>
        <mx:HTTPService id="userRequest" result="handleResult(event)" url="http://localhost/connect.php" useProxy="false" method="POST">
            <mx:request xmlns="">
                <username>{nm.text}</username><rollnumber>{roll.text}</rollnumber>
            </mx:request>
        </mx:HTTPService>
        <mx:DataGrid id="dg1" x="69" y="261">
            <mx:columns>
                <mx:DataGridColumn headerText="Name" dataField="name"/>
                <mx:DataGridColumn headerText="Roll" dataField="roll"/>
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    PHP Code:
    <?php
        mysql_connect("localhost", "root", "") or die("cannot connect");
        mysql_select_db("std_db") or die("cannot select database");
        if ($_POST["username"])
            $name = mysql_real_escape_string($_POST["username"]);
            $roll = mysql_real_escape_string($_POST["rollnumber"]);
            $query = "INSERT INTO student (name , roll) VALUES ('$name', '$roll')";
            if(mysql_query($query))
                echo "sucessfully inserted";
            else
                echo" error occured";
        $query="SELECT * FROM student";
        $result = mysql_query($query);
        $num_rows = mysql_numrows($result);
        $i=0;
        while ($i < $num_rows)
            $getName = mysql_result($result,$i,"name");
            $getRoll = mysql_result($result,$i,"roll");
            print "<player><name>".$getName."</name><roll>".$getRoll."</roll></player>";
            $i++;
    ?>

  • Can I connect Oracle with SQL-Server

    Hi,
    Is it possible to do Oracle hetrogeneous connectivity with Sql Server??
    Regards,
    Darshan

    Hi,
    I wanted to know whether Transparent Gateway for SQL Server is installed or not?
    In my $ORACLE_HOME I found following folders
    tg4ifmx, tg4ingr, tg4sybs, tg4tera.
    =========================
    If I want to install Gateway for SQL Server, From where do I install it???
    JAI HIND
    Darshan

  • How to Connect Oracle with Crystal Reports

    Hi Everyone,
    I am new to Crystal Report,
    Just tell me how to connect Crystal Report thro' Oracle 9i or 10g Forms
    With regards,
    Krishnan

    You may want to use ODBC for the connectivity.

  • Connect Oracle with Java

    I want to access oracle database from my java program which is written on Java Swing. e.g suppose my program shows a screen containing a "Name" field and a button "Submit". When i will enter a name and press the submit button the name will be stored into a table . How can i do that?
    I use Oracle 8i for database and JDK 1.7.0 for Java environment.

    Hi,
    Use the below code to connect to the Oracle DB and do the required Operation with the custom parameters for IP etc.,.
    public static void updatEmp(int empNo, String eName){
              System.out.println("Oracle Connect Example.");
              Connection conn = null;
              String ipAddress ="";
              //Spedify your IP address
              String tnsName = "";
              // Specify your tns name eg. "orcl"
              String url = "jdbc:oracle:thin:@"+ipAddress+":1521:"+tnsName;
              String driver = "oracle.jdbc.driver.OracleDriver";
              String userName = "scott";
              String password = "tiger";
              try {
              Class.forName(driver).newInstance();
              conn = DriverManager.getConnection(url,userName,password);
              System.out.println("Connected to the database");
              conn.setAutoCommit(false);
              PreparedStatement preStmt = conn.prepareStatement("update emp set ename = ? where empno =?");
              preStmt.setInt(2, empNo);
              preStmt.setString(1,eName);
              preStmt.executeUpdate();
              Statement st = conn.createStatement();
                        // For insertion to oracle
              int i = st.executeUpdate("insert into emp (empno,ename) values("+empno+",'"+ename+"')");
              System.out.println("No. of rows updated = "+i);
                        //For Selection from oracle
              /* ResultSet res = st.executeQuery("SELECT empno,ename FROM EMP ");
              while (res.next()){
                   System.out.println("Number of column:"+res.getInt(1));
                   System.out.println("Number of column:"+res.getString(2));
                   conn.rollback(); */
                   // For Updation to oracle
              /*int i = st.executeUpdate("update emp set ename='Hamlet' where empno=7369");
              System.out.println("No. of rows updated = "+i);*/          
              conn.close();
              System.out.println("Disconnected from database");
              } catch (Exception e) {
              e.printStackTrace();
    Note:
    Have to include the ojdbc14-10.2.0.2.0.jar in your java environment, which is the driver for Java to connect to oracle. If it is in Eclipse include using External jar files. If the java environment is Servers put the jar file in your lib folder under Web-INF folder..:-)
    Thanks
    Edited by: Ramesh_R on Aug 26, 2009 8:53 PM

  • Connection Oracle with ASP

    Hi all.
    I have problems with connection ASP and Oracle. I use Windows Server 2008 Enterprise R2 64 bit.
    All this string connections not working:
    cn.Open "Provider=MSDASQL;DRIVER={Microsoft ODBC for ORACLE};UID=ROOT;PWD=XXXXXX;Server=ORCL"
    cn.Open "Provider=MSDAORA.1;Password=XXXXXX;User ID=ROOT;Data Source=ORCL;Persist Security Info=True;"
    cn.Open "Provider=msdaora; Data Source=ORCL; User Id=ROOT; Password=XXXXXX;"
    cn.Open "Driver={Microsoft ODBC for Oracle};Server=ORCL;Uid=ROOT;Pwd=XXXXXX;" Can you help me?
    Many thanks
    MR

    Thanks x your help.
    Now I have this error:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Connection string:
    cn.Open "Provider=OraOLEDB.Oracle;Data Source==C800FSI1;UserId=DIP;Password=XXXXXX;"Listener.ora
    # listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_2)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_2\bin\oraclr11.dll")
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
    ADR_BASE_LISTENER = C:\app\Administratorsqlnet.ora
    # sqlnet.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\sqlnet.ora
    # Generated by Oracle configuration tools.
    # This file is actually generated by netca. But if customers choose to
    # install "Software Only", this file wont exist and without the native
    # authentication, they will not be able to connect to the database on NT.
    NAMES.DEFAULT_DOMAIN = C800FSI1
    SQLNET.AUTHENTICATION_SERVICES = (none)
    SQLNET.AUTHENTICATION = (none)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)TnsNames.ora
    # tnsnames.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    C800FSI1_2 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = C800FSI1_2)
    ORACLR_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        (CONNECT_DATA =
          (SID = CLRExtProc)
          (PRESENTATION = RO)
    C800FSI1 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = C800FSI1)
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
      )Can you help me?
    Edited by: user6317803 on 26-gen-2011 13.01

  • Connect Oracle with rm Cobol

    hi, i have a application in oracle 10g and i want to read data from a rmcobol, anyone knows how can i connect to a rmcobol. any gateway???
    thanks in advance
    Roberto

    I am not aware of a Transparent Gateway for rmcobol, but if you have ODBC drivers, you could try Generic Connectivity.
    Here's a quick start to Generic Connectivity :-
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:4406709207206#18830681837358

Maybe you are looking for

  • Need to restore trashed time machine backup - help

    Help..  I was recently burgled and my iMac and my backup drive ( on which I used TIme Machine) were taken.  So I lost everything. (No, i didnt have the time or extra monel to create another backup for off-sire storage, a mistake i will never make aga

  • How to extend the table control of ME22N ?

    Can somebody tell how to add a field to the tablecontrol of ME22N ? I think that it is not possible to do it via classic enhancements (ME22N). I suppose the wright way is via an BADI. But how, which one, adding the field via an ci-include via customi

  • Switching between programs

    I have one little problem. I know very well how to use mac OS X in most situations but I just can't find out how to switch between programs when an override is active like battlefield 1942. I just want to look if I god messages in Adium or I like to

  • RMI Codebase Issue

    Every thing works just fine as both the Client and server runs on the same system,, but as i run one of them on a remote m/c,well i am using vmware for that, Client is not able to locate server's stub and server is not able to locate clients classes

  • PlugnPlay shopping cart.......

    I am trying to set up a shopping cart on my site to sell gift cards using PlugnPlay - I am having difficulty in getting the order form on IWEB - is anyone familiar with this process??