Connect to oracle database with php script

Hello!
How can I connect to an Oracle database with a PHP script? I read about it at www.php.net:
"Oracle 8 functions; These functions allow you to access Oracle8 and Oracle7 databases. It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client libraries to use this extension."
Where can I get these libraries from?
Who knows more about the issue?
Thanks a lot for your help!
Martin
null

Hello
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by mheibel([email protected]):
Hello!
How can I connect to an Oracle database with a PHP script? I read about it at www.php.net:
"Oracle 8 functions; These functions allow you to access Oracle8 and Oracle7 databases. It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client libraries to use this extension."
Where can I get these libraries from?
Who knows more about the issue?
Thanks a lot for your help!
Martin<HR></BLOCKQUOTE>
Install and put working a sqlnet working client (install the Oracle Client option of the Oracle Database CD ROM). Than compile php with the --oci option. Than try the samples in php.net (oci function in the help).
These are the steps... Put everything working is a little more complicated...
FS
null

Similar Messages

  • Connect to oracle database with visual studio 2005

    Hi, i have a oracle database called orcl (10.2). I am trying to connect with this database with visual studio 2005. I do this:
    In Server Explorer, right click in Data Connection and click in add connection.
    I choose oracle database and oracle provider.
    In server name I write the name of my computer, and i write the user and pass of the data base (sys or system) but it gives me this error: "ora-12514 listener doesnt know the asket for service in the description one of connection" (translated of Spanish)
    what i have to write in server name? host, host:port, LISTENER,.... what?
    Thanks

    Sometimes, you can check names using from the command line:
    $> tnsping <orcl>
    TNS Ping Utility for 32-bit Windows: Version 8.1.7.0.0 - Production on 10-ENE-20
    06 09:01:04
    (c) Copyright 1997 Oracle Corporation. All rights reserved.
    Attempting to contact (ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))
    Realizado correctamente (0 mseg)
    $>

  • Connect to oracle database with Oracle.DataAccess.Lite_wce.dll

    With Oracle.DataAccess.Lite_wce.dll i want to ceonnect to oracle database.
    I try like:
    OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=baza1)));User Id=xx;Password=xx;");
    conn.Open();
    but it said "S1000[POL-3023] the database does not exist".
    What i am doing wrong?

    what client are you using if you are using windows mobile then
    use
    Oracle.DataAccess.Lite.dll on the handheld
    connection string is "dsn=databasename;uid=SYSTEM;pwd=userpassword"
    the username is always system, the passw0rd the the user password of the specific user that the handheld is created for, the database name depends you can see it in the device->orace->odbc.txt file
    if your re on c# then you should write
    using Oracle.DataAccess.Lite;
    LiteConnection OraCon;
    OraCon = new LiteConnection(connectionstring);
    OraCon.Open();

  • How Connect to oracle database with java

    i have trouble with my program
    i use oracle 8i to my database and java for interface
    this mycode :
    import java.sql.*;
    class TestThinApp {
    public static void main (String args[])
    throws ClassNotFoundException, SQLException {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // or you can use:
    // DriverManager.registerDriver(
    // new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection(
    "jdbc:oracle:thin:@dssw2k01:1521:orcl","scott","tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery(
    "select 'Hello Thin driver tester '||USER||'!' result from dual");
    while(rset.next())
    System.out.println(rset.getString(1));
    rset.close();
    stmt.close();
    conn.close();
    i have trouble , becouse i can connect my database with java (JDK)
    if any one can help me pls?
    arif

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • Connect to Oracle database from Perl on Solaris x86

    Hi,
    How can I connect to Oracle database using Perl scripts on Solaris x86. It seems that DBD-Oracle Perl module requires Oracle client installed to work. Is there any Oracle client available for Solaris x86? Any one got a workaround? Thanks.
    Angus Lee

    Yes, you absolutely must have some portions of the rdbms installed before you can proceed. If your Solaris x86 machine is only a client, then you can get away with installing just ?/rdbms/mesg and ?/rdbms/lib.
    I have Oracle 7.3.4, 8.0.5, 8.0.6, and 8.1.6 for Intel Solaris 2.6. I don't know if they'll run on Solaris 8 or 9 but I'm trying to upgrade at this very moment. As long as you conform to Oracle developer license, then you may download them from my machine.
    I believe the reason Oracle dropped their Intel Solaris port is probably because Sun went through a period where they themselves dropped their Intel port. They've picked back up and if enough Oracle on Intel Solaris customers scream, then Oracle might pick it back up again too.
    Send me an email if you're interested in the downloads.

  • Using php to connect to Oracle Database 11g Release 2 Enterprise Edition

    Greetings everyone!
    Please i dont know how to connect to Oracle Database 11g Release 2 Enterprise Edition with php even though i connected with php successfully with Oracle Database 11g Express Edition with the php code below. can someone help please...
    define('ORA_CON_UN', 'hr'); // User name
    define('ORA_CON_PW', 'Adlibs14$'); // Password
    define('ORA_CON_DB', '//localhost/XE'); // Connection identifier
    // use constants defined in anyco_cn.inc
    $conn = oci_pconnect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);
    if (!$conn) {
    db_error(null, __FILE__, __LINE__);
    Edited by: user11273096 on Jul 14, 2011 3:41 PM

    Note that this forum is for XE Beta, not EE.
    Can you connect from some other client tool, such as sqlplus?
    There's a {forum:id=178} forum that may be more suitable, if basic connectivity outside php works (i.e. issue is only php specific).

  • Using php to connect to Oracle Database 11g Release 2 Enterprise Edition EE

    Greetings everyone!
    Please i dont know how to connect to Oracle Database 11g Release 2 Enterprise Edition with php even though i connected with php successfully with Oracle Database 11g Express Edition with the php code below. can someone help please...Note im referring to oracle EE not XE.
    define('ORA_CON_UN', 'hr'); // User name
    define('ORA_CON_PW', 'Adlibs14$'); // Password
    define('ORA_CON_DB', '//localhost/EE'); // Connection identifier
    // use constants defined in anyco_cn.inc
    $conn = oci_pconnect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);
    if (!$conn) {
    db_error(null, __FILE__, __LINE__);
    Edited by: user11273096 on Jul 15, 2011 12:03 AM

    Find the hostname and service name of the database and use those values in the ORA_CON_DB constant.
    Use 'lsnrctl status' on the database host to find the service name.
    If you use a "tns" alias, you may need to create a tnsnames.ora file where PHP can access it.
    Set the environment variable TNS_ADMIN (on Linux) to the directory containing the file.
    See the section "Oracle Database Name Connection Identifiers" p 102 of the free book
    http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

  • To connect oracle database with ms access database

    i want to connect oracle database with ms access database
    i have follow the following steps
    1. create ms access database.
    2. create system dsn.
    3. make change in listener.ora.
    4. make change in hs folder.
    5.change the tnsname.ora.
    6. lsnrctl stop and lsnrct start.
    7. create database link in oracle sql*plus.
    8.select the table of ms access
    but i have return the foloowing error.
    ORA-12154: TNS:could not resolve the connect identifier specified
    using window 2000, oracle 10g

    Have a look on ths thread, may it helps ...
    Re: copy access data into oracle with form builder 9i

  • How to connect oracle database with JAVA

    how to connect oracle database with JAVA....
    using j2sdk and Jcreator . which connector to use .. what are the code for that ..

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • Unable to connect to my Oracle Database with Microsoft's ODBC for Oracle driver

    I am unable to connect to my Oracle Database with Microsoft's ODBC for Oracle driver vers.2.573.4202.00 on a Win98 computer.
    First, I create a "Net Service Name" in order for the ODBC Driver to find the Oracle server. I then created a System DSN in the ODBC Data Source Administrator and assigned the "Net Server Name" as the server in the "Microsoft ODBC for Oracle Setup". But when I test this DSN with Oracle's provided "Oracle ODBC 32Bit Test vers.2.5.3.1.0" I get an error:
    SQLSTATE: NA000
    Native Error Code:0
    Driver Message:[Microsoft][ODBC driver for Oracle][Oracle]
    This error occurred on all three Win98 computers I have tried. It does however, seem to work fine on WinNT 4.0, and believe it or not, on the two Win95 computers I have tried.
    Does anyone have any fixes, recomendations, or advice?
    Thank you,
    Eric Edwards
    null

    Why are yu not using the Oracle ODBC driver - these can be downloaded from OTN.
    Have you set up a tnsnames.ora entry for the Oracle database you want to connect to? Does this name have a domain name added to it? Check %ORACLE_HOME%\network\admin\tnsnames.ora for the service name. If it is a name of the form :
    name.domain.subdomain
    then you should try using this full name when configuring the ODBC data source.
    null

  • Connect ORACLE database with sysdba privileges

    Hi Guru,
    I am connecting to my ORACLE database with my VB application.
    I have problem with connecting to the database with SYSDBA privileges. i.e it is not connecting to the database with SYSDBA privileges.
    If I connect my db from SQLPLUS. Its worked like this..
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> select Name from v$datafile;
    select Name from v$datafile
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> connect as sysdba;
    Enter user-name: user_1
    Enter password: ****
    Connected.
    SQL> select Name from v$datafile;
    NAME
    C:\NEW\ORADATA\ITPL\SYSTEM01.DBF
    C:\NEW\ORADATA\ITPL\UNDOTBS01.DBF
    C:\NEW\ORADATA\ITPL\CWMLITE01.DBF
    C:\NEW\ORADATA\ITPL\DRSYS01.DBF
    C:\NEW\ORADATA\ITPL\EXAMPLE01.DBF
    C:\NEW\ORADATA\ITPL\INDX01.DBF
    C:\NEW\ORADATA\ITPL\ODM01.DBF
    C:\NEW\ORADATA\ITPL\TOOLS01.DBF
    C:\NEW\ORADATA\ITPL\USERS01.DBF
    C:\NEW\ORADATA\ITPL\XDB01.DBF
    10 rows selected.
    SQL>
    Now in my VB application if I am using following string to connect the database.
    m_adoCnn.ConnectionString = Provider=MSDAORA;Password=pass;User ID=user_1;DBA Privilege=SYSDBA;Data Source=ITPL
    It will connect properly to the database but gives error while executing the query select Name from v$datafile;
    as,
    ORA-00942: table or view does not exist
    Can any body help me in this or provide me proper connection string.

    Hello,
    I am getting below error when i kust Clic k on Test Connection in SSMS:
    TITLE: Microsoft SQL Server Management Studio
    The test connection to the linked server failed.
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "test".
    OLE DB provider "OraOLEDB.Oracle" for linked server "test" returned message "ORA-12154: TNS:could not resolve the connect identifier specified". (Microsoft SQL Server, Error: 7303)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.4000&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
    BUTTONS:
    OK
    Can you please guide is there any other setting i need to do after install Oracle Client ?
    Best Regards,
    Tushar Malvi

  • Connecting MS-Access database with Oracle Forms

    Hai,
    Can any one suggest as to how I can connect MS-Access database
    with Oracle Developer Forms. What is the procedure ? Suggest me
    if I need to install any drivers. Waiting for an early reply.
    Warm Regards,
    Raghav.
    email:[email protected]

    Not possible as far as I know.
    Probably because ODBC itself (the defined interface) doesn't support it.
    There is a commercial MS Access (java only) driver that might support it.

  • Unable to connect to Oracle Database using Oracle Sql developer 2.1.1.64

    Hi Everyone,
    I am searching for some help regarding my problem with Oracle connectivity. I have installed Oracle 11g release 2 on my Windows XP Professional Laptop. For a few days after installation i could connect to the Oracle database with the SYSTEM account using Oracle SQL developer ( installed on the same Laptop) but now i am unable to do so.It gives me this annoying message:
    An error was encountered performing the required operation  Got a minus one from read call .Vendor code 0
    However i am able to connect using Sql Plus by supplying the username SYSTEM and the corresponding password.
    My TNSNAMES .ora file is as follows:
    ORACLE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORACLE)
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    My Listener.ora file is as follows:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:D:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    (SID_DESC =
    (GLOBAL_DBNAME = Oracle)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (SID_NAME = Oracle)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    ADR_BASE_LISTENER = D:\app
    My Sqlnet.ora file is as follows:
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    I am new to Oracle and so i need someone in this forum who can help me resolve this problem. Also i even tried connecting to the database using Toad 10.5.0.41. It give me the following error:
    ORA 12537 : TNS Connection closed
    Thanks for your patience and help in advance.
    ---Prashant

    Hello Irian and Sue,
    I can connect to the Oracle database using SQL Plus. Now when i TNSPING ORACLE from command line i get the following message :
    Used parameter files:
    D:\app\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost
    *)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACLE)))*
    TNS-12537: TNS:connection closed
    Thanks for your response to my initial post.Do u have any other methods to resolve this?

  • Not able to connect remote oracle database over VPN

    I can not connect remote oracle database over VPN. tnsping is ok and it shows the server information of remote database. i can also telnet the 1521 port of remote database server. I can connect the same server when it is located in the same LAN. Please help me out this is very urgent.

    6b6c669e-6baa-45c4-a6dc-444aef2d5e7a wrote:
    I can not connect remote oracle database over VPN. tnsping is ok and it shows the server information of remote database. i can also telnet the 1521 port of remote database server. I can connect the same server when it is located in the same LAN. Please help me out this is very urgent.
    First, this is a forum of volunteers.  There is no "urgent" here.
    "Urgent" means one of two things -
    1) people are dying, or
    2) you have a customer-facing, revenue-producing production system that is down.
    (And to get some perspective on the second case, keep the first in mind.)
    For the first, you call whatever civil emergency service seems appropriate.
    For the second, you open an SR with Oracle - which requires a paid-up support contract. For *them* to consider your problem "urgent", you will need to demonstrate that your problem falls under item #2. I seriously doubt your problem fits that criteria.
    You don't have a support contract?  Now you know the exact dollar figure that your company places on the data.
    That said, you need to understand a few things about your specific problem,
    First, port 1521 is only used by the listener to accept a connection request.  Once it gets that request (and finds that it is for a service (sid) that it knows about, it will fork a server process and tell the requesting client that it can communicate with that server process over some other port .. a randomly chosen port number in the "high" range.  It could be your vpn is blocking that other port, whereas your internal firewall is not.
    But this is just an educated guess since I cannot find "can not connect remote oracle database over VPN" in any error message manual. If you had mentioned the VPN along with an actual oracle error message we could be much more precise in our diagnoses and recommendations.
    ---- edit 22 Sep
    It occurred to me that I just assumed you were using the same client machine in both cases ... a laptop that you use both at work (local network) and home (vpn).  If that assumption is false, there are probably problems with your tns setup on the home (vpn) machine.
    But again, it would be much easier to help if you gave us an actual error message.

  • Unable to connect to Oracle database running on Windows machine from linux.

    Hi,
    I'm not able to connect to oracle database running on Windows machine from Linux machine. I'm geting the below mentioned error. I have given below the code I used to connect to database and database propertes.Do I need to use any specific driver?
    Please help me.
    Thanks,
    Sunjyoti
    Code :
    import oracle.jdbc.pool.OracleDataSource;
    import java.sql.Connection;
    import java.util.*;
    import java.sql.*;
    import java.io.*;
    class try2{
    public static void main(String args[]) {
    try {
              System.out.println("hi");
    // Load the properties file to get the connection information
    Properties prop = new Properties();
    prop.load(new FileInputStream("/home/sreejith/EDIReader/Connection.properties"));
    // Create a OracleDataSource instance
    OracleDataSource ods = new OracleDataSource();
    System.out.println("prop is "+prop);
    configureDataSource(ods, prop);
    Connection conn=null;
    // Create a connection object
    conn = ods.getConnection();
         System.out.println("Connection is"+conn);
    // Sets the auto-commit property for the connection to be false.
    conn.setAutoCommit(false);
    } catch (SQLException sqlEx){ // Handle SQL Errors
    System.out.println("In exception "+sqlEx);
    } catch(Exception excep) { // Handle other errors
    System.out.println(" Exception "+ excep.toString());
    private static void configureDataSource(OracleDataSource ods, Properties prop) {
    // Database Host Name
    ods.setServerName(prop.getProperty("HostName"));
    // Set the database SID
    ods.setDatabaseName(prop.getProperty("SID"));
    // Set database port
    ods.setPortNumber( new Integer( prop.getProperty("Port") ).intValue());
    // Set the driver type
    ods.setDriverType ("thin");
    // Sets the user name
    ods.setUser(prop.getProperty("UserName"));
    // Sets the password
    ods.setPassword(prop.getProperty("Password"));
    Connection properties :
    # Your Database Connection details
    HostName = 10.20.3.19
    SID = EDIREAD
    Port = 1521
    UserName = dbuser
    Password = dbuser
    Error I'm getting is
    error while trying to connect with odbc datasource
    [root@iflexpau2217 EDIReader]# java try2
    hi
    prop is {HostName=10.20.3.19, Password=dbuser, UserName=dbuser, SID=EDIREAD, Port=1521}
    In exception java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    Also I tried to connect with weblogic JDBC driver
    Code is here:
    import java.io.BufferedReader;
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    //import com.entrust.toolkit.util.ByteArray;
    public class trial{
         public static void main(String args[]) throws IOException{
              System.out.println("hi");
              Connection p_conn = null;
              PreparedStatement xml_insert = null;
              try {
         // Load the JDBC driver
                   System.out.println("hi2");
         // String driverName = "oracle.jdbc.driver.OracleDriver";
    String driverName = "weblogic.jdbc.oracle.OracleDriver";
         System.out.println("hi2");
         Class.forName(driverName);
         // Create a connection to the database
         String serverName = "10.20.3.19";
         String portNumber = "1521";
         String sid = "EDIREAD";
         //String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
    String url = "jdbc:bea:oracle://10.20.3.19:1521";
         String username = "dbuser";
         String password = "dbuser";
    System.out.println("connection is:"+p_conn+"user name is"+username+"password is"+password);
         p_conn = DriverManager.getConnection(url, username, password);
         System.out.println("connection is:"+p_conn+"user name is"+username+"password is"+password);
              xml_insert=p_conn.prepareStatement("insert into PRTB_SUBUNIT (SUBUNT_ID,SUBUNT_SUB_UNIT,SUBUNT_PHYUNT_ID) values (?,?,?)");
              //InputStream in=null;
              File l_file=new File("/home/sreejith/EDIReader/propertyfiles/inputfile/BUG_10802_ES_CSB19_68.txt");
              BufferedReader input =null;
              input=new BufferedReader(new FileReader(l_file));
              String line = null;
              StringBuffer trial=new StringBuffer();
              while (( line = input.readLine()) != null){
                   trial.append(line);
                   trial.append(System.getProperty("line.separator"));
              //InputStream is = new BufferedInputStream(new FileInputStream(l_file));
              System.out.println(trial.toString());
              //Blob b ;
              //byte[] bytes=trial.toString().getBytes();
              //System.out.println("Size-->"+bytes.length);
              xml_insert.setString(1,new String("SpecailChar"));
              //xml_insert.setBinaryStream(2,new ByteArrayInputStream(bytes),15920);
              xml_insert.setString(3,"SpecailChar");
              xml_insert.executeUpdate();
              p_conn.commit();
              } catch (ClassNotFoundException e) {
                   System.out.println("ClassNotFoundException:"+e.getMessage());
              // Could not find the database driver
              } catch (SQLException e) {
                   System.out.println("SQEXCEPTIN:"+e.getMessage());
              // Could not connect to the database
              }catch (FileNotFoundException e) {
                   System.out.println("filenot found:"+e.getMessage());
              // Could not connect to the database
    Error I'm getting is
    error while trying with jdbc:
    SQEXCEPTIN:[BEA][Oracle JDBC Driver]Error establishing socket to host and port: 10.20.3.19:1521. Reason: Connection refused

    Is the Windows firewall active? Have you enabled the port on the firewall, if it is?

Maybe you are looking for