Connection to oracle via php

hi,
I am making a site with a connection to oracle Xe but I am not able to connect me;
here script:
<?php $user = @$_post['login'];
$passwd = @$_post['pass'];
$bd = "(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)
(HOST = titanium)(PORT = 1521))
(CONNECT_DATA=(SERVER = DEDICATED)
(SERVICE_NAME = XE)))";
$conn = ocilogon($user, $passwd, $bd);
$query = "select * from cabine";
$stid = OCIParse($conn, $query);
ociexecute($stid);
while (ocifetch($stid)) {
echo "\n";
$ncols = ocinumcols($stid);
for ($i = 1; $i <= $ncols; $i++) {
$column_name = ocicolumnname($stid, $i);
$column_value = ociresult($stid, $i);
echo $column_name . ': ' . $column_value . "\n";
echo "\n";
ocifreestatement($stmt);
?>
I use easyphp 1.0, and oracle express edition;
here error message:
Warning: ocilogon(): OCISessionBegin: ORA-01017: nom utilisateur/mot de passe non valide ; connexion refusée in c:\program files\easyphp1-8\www\facture.php
what must I modify to make function the connection. Thank

Try echo'ing the username & password to check they are set correctly.
Is the user account created and unlocked?
This free book has some useful information on PHP and Oracle: http://tinyurl.com/f8jad
-- cj

Similar Messages

  • Errors connecting to Oracle via perl DBI

    Hi List.
    I've installed Oracle on my linux box (SuSE 10) and I've installed
    DBD::Oracle.
    I can run sqlplus as the oracle user however when I try and connect via
    DBD::Oracle in a perl script I always get errors as follows:
    connect string =
    my $dbh = DBI->connect("dbi:Oracle:ORCL", 'oracle', 'oracle' );
    error =
    DBI connect('ORCL','oracle',...) failed: ORA-12541: TNS:no listener (DBD
    ERROR: OCIServerAttach) at ora1.pl line 7
    Connection Failed...
    connect string =
    my $dbh = DBI->connect("dbi:Oracle:HOST=linux.site;SID=ORCL;PORT=1522",
    'oracle', 'oracle' );
    error =
    DBI connect('HOST=linux.site;SID=ORCL;PORT=1522','oracle',...) failed:
    ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach) at ora1.pl line 7
    Connection Failed...
    Maybe I have the connect string wrong?
    Below is a listing of my code, and my tnsnames.ora:
    Thanks in advance for your help.
    ############ code listing ################ #!/usr/bin/perl
    use DBI;
    print "Started\n";
    my $dbh = DBI->connect("dbi:Oracle:HOST=linux.site;SID=ORCL;PORT=1522",
    'oracle', 'oracle' );
    if ($dbh) {
    print "Connected...\n";
    else {
    print "Connection Failed...\n";
    exit;
    my $qry = $dbh->prepare("select count(*) from dba_tables");
    $qry->execute();
    my @data = $qry->fetchrow_array();
    print "[$data[0]] [$data[1]] [$data[2]]\n";
    exit;
    ######### tnsnames.ora listing #####################
    # Generated by Oracle configuration tools.
    LISTENER_ORCL =
    (ADDRESS = (PROTOCOL = TCP)(HOST = linux.site)(PORT = 1522))
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = linux.site)(PORT = 1522))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    )

    'TNS: no listener' usually means that your listener hasn't been started. Try a lsnrctl status to find out whether your Listener is actually running.

  • Connect to Oracle via WAP

    When I connect to Oracle 8.1.7 in ASP I use following:
    <%
    Set conn = Server.CreateObject("ADODB.connection")
    Conn.Open strOracleCnn
    SQL = "SELECT * FROM MMS.TBruger"
    Set Rs=Conn.Execute(SQL)
    %>
    How to when I connect via WAP ?

    Yes, it works okay in general--I can do a simple select and I get results.  My guess, too, was that it's an ODBC driver issue.
    I was just about to say that I've tried connecting using the Oracle driver with the localhost as the server and one of the tunneled ports as the port--and it hadn't worked.  But I FINALLY figured out that what I thought was the correct SID was NOT the correct SID.  Now that I've got the correct SID, the Oracle driver is working fine this way.
    Thanks a million!

  • Connect to Oracle from PHP

    Hello
    I have problems to connect to Oracle database from PHP. I use php_oracle.dll. (I can't use OCI8 because the version of our oracle is 8.0).
    We have 2 oracle servers:
    One of them connect ok. But I can't connect to the second server. The main difference is the user. In the second server is like 'ops$p123lmn'. In the first server is only text, e.g. 'dbaper'. Can be a problem the '$' in the username?
    I connected through ODBC in PHP and ok both oracle servers.
    I use ora_logon like:
    $ora_conn = ora_logon("ops$p123mln@siap","pass");
    when ops$p123mln is the user, siap is the SID and pass is the password.
    I'm desperate because I don't find a solution.
    Thanks in advance to all.
    Jose Martin

    If I had to guess, I would say that PHP is probably seeing the string "ops$p123mln@siap" and interpreting it as "ops${p123mln}@siap", which would resolve to "ops@siap", which is way wrong.
    Try replacing the string with 'ops$p123mln@siap' (single-quotes around the string instead of double-quotes).
    Hope that helps.

  • Help connecting to Oracle via ADODB in MS Access 2003

    I'm attempting to use vb within Microsoft Access to return a recordset.
    I can connect, but I when I execute my select statement, I get the following message:
    Run-time error '-2147217865 (80040e37)':
    [Microsoft][ODBC driver for Oracle][Oracle]ORA-00942: table or view does not exist.
    I've doublechecked the tablename in the select statement, and it is good. I've run the select statement directly from Access - using a linked table within Oracle, and it runs fine.
    I'm using Oracle Net Manager 10.2.0.0.0, and my ODBC driver is "Oracle in OraClient10g_home1" My OS is XP SP2
    Here is the connection (details obscured) info I'm using: Note. I don't get the error until I open the recordset.
    strConnect = "Driver={Microsoft ODBC for Oracle};Server=myoradb;Uid=userid;Pwd=pass;"
    sql = "select * from TABLE where SOMETEXTFIELD='sometextvalue'"
    Set conn = CreateObject("ADODB.Connection")
    Set rsSizing = CreateObject("ADODB.Recordset")
    conn.open strConnect
    rsSizing.open sql, conn, 3, 1
    Any help would be much appreciated,
    Joe

    962228 wrote:
    At our College, we have a server with Oracle installed and 33 clients connecting to the Oracle database on the server. This semester, for whatever reason, we're having an issue linking from MS Access 2013 (32-bit) to the Oracle database. We create the link and it seems to work fine after entering username and password (we are using the 32 bit ODBC drivers). However, when we connect, the window that shows the available tables to link to shows no tables. Its' completely blank. We can see the tables through the database side, and the drivers *seem* to be ok . . . has anyone seen this before? We're new to Oracle and are not sure what the problem could be. Any help is greatly appreciated. Thank you!
    I know this probably isn't much help, but many years ago I was faced with an issue that sounded somewhat similar.  User department had an Access application.  The .mdb file was on a file server, so everyone in the department was using the same file .. not indivdual copies that could have diverged.  Desktop PC configuration was tightly controlled by IT, so assumed the same for each.  Even though all seemed to connect to the Oracle db, some saw data and other saw "????".  Connection to the Oracle db was via ODBC.  In the end, the only solution we came up with was to configure some users with the Oracle ODBC driver and others with the MS ODBC for Oracle. 

  • How to connect to Oracle via ODBC without DSN?

    Does anyone know how to use SQLDriverConnect without DSN for Oracle 8.x? What paramaters must be provided in the connection string?
    Thanks in advance.

    You really want to take a look at the help file here, as it gives all the appropriate parameters. I never remember them off the top of my head.
    Justin

  • Trying to get connected to Oracle via tcp redirection, cant get it working.

    Hi All
    I have an oracle server behind a firewall, and i want to connect to it directly.. Let's say the Oracle is on 10.0.0.1 and I want to connect to it over internet. Machine has a public IP of 12.34.56.78 and an open port 80.
    I have a software that will take any bytes sent to port 80, and send them to 1521, and same for reverse direction, so I run this on the box with oracle, and I can certainly TELNET 12.34.56.78 80 just fine.. And I can TNSPING it after I set this host and port in tnsnames
    But it seems that oracle "knows" its IP address is 10.0.0.1 and when I connect a client to 12.34.56.78 port 80, the client is then seen (sniffing the network traffic) to immediately try connecting to 10.0.0.1 on some random port in 4000 range, as if oracle has told it "ok, now connect to me on 10.0.0.1 4000"
    What is going on/how can I stop oracle behaving in this way?

    Charred,
    Let's say you put the tns listener listening on the public IP and in port 1521, this is only the way in. On the way out the TNS process does a hand-shake between the user process connecting from the outside and the server process forked inside the machine to serve that session, but it comes out through a different port, in a random range.
    What you need to do is to let the binaries of Oracle pass whatever they want through the firewall instead of opening ports. I'm assuming your firewall technology lets you do that.
    Hope it helped.
    LMC

  • Userid prefix when connected to LCCS via PHP

    I'm using the PHP service class packaged in the SDK and each user connects to the LCCS with the getAuthenticationToken function.
    But when I get updates within a running flash app from the UserManager, the userid got a prefix of "EXT-{lccs account name}-{userid}" where
    I expect it only to be "{userid}".
    How can I fix that? Or is it just the way LCCS handles authentications through PHP?
    Thanks in advance,
    Florus

    this is how external user ids are generated on our server. In order to have globally unique identifier the format is :
         EXT-<youraccountname>-<youruserid>
    With the latest SDK I have added a Session.getUserID method that given your id returns the service id, so that you don't have to know the magic.

  • Cannot Connect to Oracle, PHP cannot load oci dlls

    Hello,
    I have installed wamp on windows server, and oracle 9, When I try to connect to oracle in php I get:
    Fatal error: Call to undefined function oci_connect() in C:\wamp\www\project2\index.php on line 3
    Also when I start wamp, it cannot load the oci dlls found on:
    C:\wamp\bin\php\php5.3.0\ext
    I have configured the php.ini file and commented as much options
    extension_dir = "C:/wamp/bin/php/php5.3.0/ext/"
    extension=php_oci8.dll ; Use with Oracle 10gR2 Instant ...
    extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client
    extension=php_oracle.dll
    extension=oci8.so
    I am unable to either connect to the database through php, also when I start wamp, i get pop up windows that it cannot load the dynamic procedures related to oracle: php_oce.dll, php_oce8.dll, php_pdo_oci,
    I have even eddited the http.conf file
    Also have done this:
    •Add the following entries to the "C:\Apache\Apache\conf\httpd.conf" file:
    LoadModule php4_module c:\php\sapi\php4apache.dll (approx line 193)
    AddModule mod_php4.c (approx line 241)
    AddType application/x-httpd-php .php (approx line 851)
    I have included the phpinfofile attached as well, part of it below is:
    System Windows NT SELECAO 5.2 build 3790 (Windows Server 2003 Standard Edition Service Pack 2) i586
    Build Date Jun 29 2009 21:23:30
    Compiler MSVC6 (Visual C++ 6.0)
    Architecture x86
    Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared"
    Server API Apache 2.0 Handler
    Virtual Directory Support enabled
    Configuration File (php.ini) Path C:\WINDOWS
    Loaded Configuration File C:\wamp\bin\php\php5.3.0\php.ini
    Configuration
    apache2handler
    Apache Version Apache/2.2.11 (Win32) PHP/5.3.0
    Apache API Version 20051115
    Server Administrator admin@localhost
    Hostname:Port localhost:80
    Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100
    Timeouts Connection: 300 - Keep-Alive: 5
    Virtual Server No
    Server Root C:/wamp/bin/apache/Apache2.2.11
    Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_php5

    I get this error, i decided to change directory for oracle_home
    putenv("ORACLE_HOME=C:/oracle/product/10.2.0/db_1/bin");
    to
    putenv("ORACLE_HOME=C:/oracle/product/10.2.0/db_1");
    it functioned.
    my code
    <?php
    putenv("ORACLE_HOME=C:/oracle/product/10.2.0/db_1");
    putenv("ORACLE_SID=PLSExtProc");
    $user ="name"; // set user
    $senha="password"; // set password
    $banco="(DESCRIPTION=
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=TCP)
    (HOST=127.0.0.1)(PORT=1521)
    (CONNECT_DATA=(SERVICE_NAME=orcl))
    )"; // configuracoes do banco (isso muda um pouco no oracle)
    if ($conexao = OCILogon($user,$senha,$banco))
    echo "Conexão bem sucedida.";
    else
    echo "Erro na conexão com o Oracle.";
    ?>

  • OraOLEDB.Oracle on x64 Win 2003 connect to Oracle 9.2 from SQL 2005 x64

    I know this is an Oracle board but some of you may also support SQL Server like I do and I am hoping someone has had the pleasure of using OraOLEDB.Oracle on 64 bit.
    I have a 64 bit SQL Server 2005 SP2 on a Windows 2003 x64. The developer said that he needed to use OLE to talk to Oracle so I went to Oracle and downloaded the 64 bit OraOLDDB driver as recommended in a MS note.
    I can connect to Oracle via tnsping and using SQLPlus but I cannot create a linked db successfully.
    The linked database errors off with >> Cannot initialize data source for OLE provider "OraOLEDB.Oracle" for Lined Server "X" (Microsoft SQL Server error: 7399) << (manually typed)
    Here is the official OS, SQL Server, and Oracle client information:
    The OS is Windows Server 2003 Standard x64 edition Service Pack 2 (NT 5.2 build 3790)
    The SQL Server 2005 9.0.3042 (x64) [from
    Microsoft SQL Server Management Studio    9.00.3042.00
    Microsoft Analysis Services Client Tools        2005.090.3042.00
    Microsoft Data Access Components (MDAC) 2000.086.3959.00
    (srv03_sp2_rtm.070216-1710)
    Microsoft MSXML                                            2.6 3.0 6.0
    Microsoft Internet Explorer                              6.0.3790.3959
    Microsoft .NET Framework                             2.0.50727.42
    Operating System                                           5.2.3790
    The OraOLEDB.Oracle driver shows that it is version 10.2.0.3
    Oracle "tnsping sid " works
    SQLPlus (ver 9.2) works
    I have serveral linked databases to Oracle that I have built but all of them are 1- on SQL Server 2000 and 2- are 32 bit.  If anyone knows of any additional patches (Windows or Oracle) necessary to resolve this I would appreciate the information.  Also there are potential firewall issues though the fact that SQLPus can be used seems to rule this out, but if there are any ports associated with OLE I would like to check on them specifically.
    -- Mark D Powell --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Thank you for reminding me what I already knew but in my haste to post out a reply I had forgotten to consider looking at the provider properties.
    Today I did and the linked database still failed. The though occurred to me a little later to delete and recreate the linked db and bingo I had a working linked database to Oracle. Now I have three of them and the developer should be working with them now.
    This is the first time I ever had to change a provider property to get the provider to work. I would have thought that when the Oracle client install process registered the OLE provider with SQL Server 2005 it would be set with the proper defaults to work.
    Thanks again to everyone
    -- Mark D Powell --

  • Connect to Oracle XE from Toad?

    I installed Oracle Express and Toad 9.2 trial version on Vista Ultimate machine. I can connect to Oracle via the Home Page but get
    ORA-12154 TNS could not resolve connect identifier when I try to connect to XE.
    I added TNS_ADMIN environment variable (system) but this did nothing.
    How do you connect to ora express from Toad?

    XE=
    (DESCRIPTION=
    (ADDRESS=
    (PROTOCOL=TCP)
    (HOST=BellaScout-PC)
    (PORT=1521)
    (CONNECT_DATA=
    (SERVER=dedicated)
    (SERVICE_NAME=XE)
    The TNS tab in toad has the following options:
    XE
    EXITPROC_CONNECTION_DATA
    ORACLR_CONNECTION_DATA
    The installed clients in Toad available:
    XE
    (Oracle Root)

  • Connect to oracle

    hi guys,
    i am reading about to connect to Oracle by php, but al the time the solution is so complicate.
    i have this
    userid
    passworld
    ip adress (1521 port)
    and i have the SID
    i can't have more information about istance oracle.
    by aquafold i connect well
    so,
    how can conncect by php_oci8.dll at this istance of oracle?
    every exsamble about connection dont use SID.
    thanks for the help

    i post the small script like this is more clear
    <?php
    $MYSIS='(
                   DESCRIPTION =
                   (ADDRESS_LIST =     
                        (ADDRESS =
                                  (COMMUNITY = tcp.world)
                                  (PROTOCOL = TCP)
                                  (Host = myiphost)
                                  (Port = 1521)
                   (CONNECT_DATA =
                             (SID = mysid)
                             (SERVER = DEDICATED)
    $conn = ocilogon("myuser", "mypass", $MYSIS) or die (ocierror());
    $query = "select onefield from mydb";
    $stmt = oci_parse($conn, $query);
    oci_execute($stmt);
    while ($row = oci_fetch_array ($stmt))
         { echo $row[0]."<br>";}
    ?>

  • 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

  • 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

Maybe you are looking for