PHP and multiple DB doesn`t work

Hi
I've been all day trying to find some clues on how to get data from two SSID on the same server (under Oracle 10g and PHP5 w/oci)
I'll explain:
The Oracle server has two schemas: datos and global.
datos: localhost:1521
SID: datos
global: localhost:1521
SID: global
in PHP this is the connection I'm trying now, after a whola day i tried to simplify to the fullest:
Line:-----
<?php
//STATEMENT 1
@     $link = oci_connect("user","password" ,"localhost"/"global");
echo "oci_fetch_array <br>";
$stmt = ociparse($link, "select rut from USUARIO");
ociexecute($stmt);
     while ($r2 = oci_fetch_array($stmt, OCI_BOTH)) {
          echo $r2['id_usuario'];
OCIFreeStatement($stmt);          
//STATEMENT 2
@     $conn1 = oci_new_connect("user", "password", "localhost"/"datos");
$SQL = "select id_usuario from USUARIO where id_empresa = '2'";
          $stmt = ociparse($conn1,$SQL);
          ociexecute($stmt);
                    while(OCIFetch($stmt)){ 
          $valor = OCIResult($stmt,1);
          echo $valor;
          OCIFreeStatement($stmt);
?>
Both sentences are tested and working so there is no problem in the PHP code.
* I've noticed that no matter what type of code I try, it always seems to only access the bolddatos*bold* schema and never even touches the global schema.
* The errors I get from this code:
Warning: ociparse() expects parameter 1 to be resource, boolean given in D:\www\index.php on line 12
Warning: ociexecute() expects parameter 1 to be resource, null given in D:\www\index.php on line 13
Warning: oci_fetch_array() expects parameter 1 to be resource, null given in D:\www\index.php on line 14
Warning: ocifreestatement() expects parameter 1 to be resource, null given in D:\www\index.php on line 18
after that, I succesfully get the result from the second statement ... so confusing
* In the begining I used the sabe user and password for both schemas, now I've changed them . In that time the error was related to tables that didn't exist so I got to the conclussion that PHP was only accesing the datos schema, as I menctioned before.
I don't know that else to do, and I'm thinking seriously on passing to another language.
I've made a Sw in Java that also access those two databases, it works perfectly, so I'm thinking that perhaps it's me who don't know how to write in PHP, or PHP's OCI that doesn't support this kind of acces to databases.
If somebody could show me some clues I'll be gratefull.

Well actually the @ signs are there so the "PHP Warning: Division by zero" is disabled, still the connection have always worked just fine for me, that's just a warning.
I really don't get the mixture between php4 and php5 as all the functions I used are documented in here http://cl.php.net/oci8.
I've always have this confussion about SID and schemas. As i understand it the schemas are database instances that are identified by an SID. Lets say, the database instance has a global name "no_godzilla", then the SID will be "nogodzilla" (oracle truncates "_" from SID). And that database will have a user and a password to grant the access.
So, the connection string must have a : username, password, SID or global database name and a specified host.
For now the second connection ($conn1) on my php file is working but the first doesn, that even when the sentences are made to be perfectly equals, for that I've created tables in both databases with tha same structure but different data. Still, the only database that seems to work is datos
Yesterday I tried to make the connection from an ODBC but found some trouble on doing that, I've received the following error:
[Oracle][ODBC][Ora]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
so, I've created a new listener and i was able to start a ODBC from the datos database but still I recieve the message when I try to connect from the other database.
After that I figured out (after reading some forums) that the error was on the listener configuration listener.ora and tnsnames.ora, I found it very troublesome to manually edit those files and after a while I just cracked and fell death on my desktop.
Then I was told to use 3 databases instead of 2, wich made my soul leave my body for a while, and I took that fine oportunity to say "hi" to some people I haven't seen in a while.
On my rebirth I decided to make tree brand new Oracle installations, so the ports on each database are different (this will solve my problem I thougth), but I only came to the same conclussion, PHP can only access one database (from 3 Oracle 10g on the same machine, Ive tested it under Oracle and mysql without problems of this kind).
Now I have 3 listeners and 3 databases, each one on localhost:1521, localhost:1522 and localhost:1523. The listeners work fine but I cant make an ODBC or make my precious code to work.
I must finish this work tomorrow, so I'm switching back to Java. Still in the future I surely will have to deal with this again so, I still ask for some clues, just so i know how to deal with this.
Right now I'll resume reading the Underground oracle and PHP manual (I've read it before but only untill page 120).
Thaks for your time.
P.S. should I post my listener.ora and tnsnames.ora? (6 in total)

Similar Messages

  • My 80gb doesn't boot up this morning. apple logo keeps coming up for a few seconds then you hear it "wind down" and got blank. Tried reseting multiple time - doesn't work. Ideas?

    my 80gb IPod doesn't boot up this morning. Worked great last nite. The apple logo keeps coming up for a few seconds then you hear it "wind down" and got blank. Tried reseting multiple time - doesn't work. Ideas?

    my 80gb IPod doesn't boot up this morning. Worked great last nite. The apple logo keeps coming up for a few seconds then you hear it "wind down" and got blank. Tried reseting multiple time - doesn't work. Ideas?

  • HT1600 After updating my apple tv last night, it has stopped working. The light blinks but there is no input to the tv. I have reset it multiple times, have unplugged it, and it still doesn't work. What can I do?

    After updating my apple tv last night, it has stopped working. The light blinks but there is no input to the tv. I have reset it multiple times, have unplugged it, and it still doesn't work. What can I do?

    connect it by usb to your computer and restore it's firmware from itunes on the very same computer

  • HT4527 How on earth do you get Home Sharing to work properly?  We have tried multiple times and it simply doesn't work for us!

    How on earth do you get Home SHaring to work?  We have tried numerous times and it simply doesn't work for us!

    Turn it on.
    Honestly, if you want help it is generally a good idea to ask a specific question and give some details of what problem is occurring.
    If trying to move media, using home sharing is simply a bad idea.  Follow some of the other instructions in the article from which the question was posted to move media.

  • Hi,i was about to update my software version of i phone 4,but suddnley power went off.now my phone is not recognised ,and my phone doesn't work,how to reinstall operating system,please help me.....

    hi,i was about to update my software version of i phone 4,but suddnley power went off.now my phone is not recognised ,and my phone doesn't work,how to reinstall operating system,please help me.....

    Put the device in DFU mode: http://www.iclarified.com/entry/index.php?enid=1034

  • I plugged my phone into my computer for the first time and it restarted my whole phone so now all my apps say waiting put I'm let my phone sync a view different times and it still doesn't work. Has anyone else had this problem?

    I plugged my phone into my computer for the first time and it restarted my whole phone so now all my apps say waiting put I'm let my phone sync a view different times and it still doesn't work. Has anyone else had this problem?

    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • I have iPhone 4S with new ios7, and panorama wallpaper doesn't work ! It let me shoose it, but it's not work, why?

    I have iPhone 4S with new ios7, and panorama wallpaper doesn't work ! It let me shoose it, but it's not work, why?

    These prices are for the U.S.
    Out-of-Warranty Service
    If you own an iPhone that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will service your iPhone for the Out-of-Warranty Service fee listed below.
    iPhone model          Out-of-Warranty Service
    iPhone 5          $229
    iPhone 4S          $199
    iPhone 4, iPhone 3GS,
    iPhone 3G, Original iPhone          $149
    A $6.95 shipping fee will be added if service is arranged through Apple and requires shipping. All fees are in U.S. dollars and are subject to local tax.
    When setting up out-of-warranty service, Apple will request credit card pre-authorization for the maximum service fee listed above.  This amount will be deducted from your credit limit. The final service fee we charge will be determined during testing and may be less than the service fee listed above.
    Certain damage is ineligible for out-of-warranty service, including catastrophic damage, such as the device separating into multiple pieces, and inoperability caused by unauthorized modifications. However, an iPhone that has failed due to contact with liquid may be eligible for out-of-warranty service.
    Apple reserves the right to determine whether or not your iPhone is eligible for Out-of-Warranty service. iPhones that are repaired or replaced have a 90-day limited hardware warranty or assume the remainder of your standard warranty or AppleCare service contract coverage, whichever is longer. Please see Apple's Repair Terms And Conditions for further details.

  • Last week, I had no problems streaming my MacBook Pro to my sony Bravia with a logix hdmi cable. I came back from holidays and now it doesn't work anymore.  What settings should my computer be on and what settings should my tv be on?

    Last week, I had no problems streaming my MacBook Pro to my sony Bravia with a logix hdmi cable. I came back from holidays and now it doesn't work anymore.  What settings should my computer be on and what settings should my tv be on?

    TarahCurrie Sep 10, 2014 3:48 PM
    Restore From Time Machine Backup
    Reinstall OS X
    Get Help Online
    Disk Utility
    MacBook Pro, Mac OS X (10.5.8)
    You are running 10.5.8
    Did you try booting off your Install disk holding the c key down.  From here you can get to the drop down menu just a few clicks in (you are not going to install) and run  the Disk Utility>Repair Disk.  See if it will let you do this.

  • HT1657 I rented a movie and the sound doesn't work, how do I fix it?, who do I direct to for a complaint?

    Hi, I rented warhorse HD, and the sound doesn't work, my itunes version is 10.6.1(7). How do I fix it or who do I direct to get my money back? Thank you

    I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the entry, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.
    (Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.)

  • My new iMac has recently had OSX Lion installed on it and now when I start the machine it looks like its updating something every time, and the wireless doesn't work. So I restart and everything is OK - until I have to start up again the next time?

    My new iMac has recently had OSX Lion installed on it and now when I start the machine it looks like its updating something every time, and the wireless doesn't work. So I restart and everything is OK - until I have to start up again the next time - then I have to repeat this again! Any help appreciated.

    I've been having the same issue, but have just discovered something on my own that hasn't been pointed out in any of the forums I've visited.  In what I thought would be a vain attempt to help myself, I went to System Preferences, Users & Groups, and then clicked on Login Items.  I discovered that one of the Items that was listed to open automatically upon login was iTunes Helper and that there was an exclamation point beside it indicating that it was incompatible.  I simply deleted that item and now I don't have the situation you described and my wireless is connected.  Hope this helps!

  • On any page that I have to log in Firefox stops responding and has to shut down. I've tried resetting it and it still doesn't work.

    I've been having this problem for a while now and I can't seem to fix it. Any time I log into any page, Firefox says not responding and I have to restart it. I have to run all of firefox in safe mode if I log out of my email or facebook. I've tried resetting FF and it still doesn't work.

    ''' "I have to run all of firefox in safe mode if I log out of my email or facebook. " '''
    Please explain what you mean by '''all of firefox'''. You're either running in the Firefox SafeMode or you're not. There's no "all" or partial SafeMode.
    Please see this: https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode

  • Using Office 2013 group policy template to define Trusted Locations and Template Locations doesn't work

    User Configuration/Policies/Administrative Templates
    - Using Office 2013 group policy template to define Trusted Locations and Template Locations doesn't work
    Microsoft Word 2013/Word Options/Security/Trust Center/Trusted Locations
    - Allow Trusted Locations on the network: 
    Enabled 
    - Trusted Location #1: 
    Enabled 
    Path:  //server/sharedfoldername   [Edit:  Path:
    \\server\sharedfoldername]
    Date: June 10, 2013
    Description: Trusted Location
    Allow sub folders: Enabled
    The policy appears to apply to the client correctly by adding the following registry key and values:
    HKEY_CURRENT_USER\Software\Policies\Microsoft\office\15.0\word\security\trusted locations\location1
    allowsubfolders: 1
    date: June 10, 2013
    Description: Trusted Location
    Path:  //server/sharedfoldername  [Edit: Path: 
    \\server\sharedfoldername]
    However, when you open Word Options/Trust Centre/Trust Centre Settings…/Trusted Locations
    There are no trusted locations listed under ‘Policy Locations’
    I have tried setting similar settings for setting the Shared Templates folder location and just like the trusted locations policy, the registry keys are created properly in HKEY_CURRENT_USER\Software\Policies however word doesn’t
    seem to recognize these either.
    This used to work flawlessly using the administrative templates for Word 2007 and 2010. Has anyone been able to get these policies to apply successfully, or know why office doesn’t recognize these settings from the Policies registry
    Key?

    This would have been an easy solution to the issue.  Unfortunately it isn't the problem.  This question was originally posted on another Microsoft site and
    was transferred here and when it was transferred the path's changed from the original post: 
    \\server\sharedfodlername to //server/sharedfoldername.  (I will edit the question to show up as it did in the original post) Not sure how that happened.  This
    is still an issue that I haven't been able to get working correctly.
    As it turns out the 'New from Template' interface Word 2013 has developed is very bulky with large thumbnails and is not very customizable nor practical for an office
    that has a large number of templates.   Because I am unsatisfied with the display and performance of the 'New' template chooser I sought after a solution to change the way word creates a document from a template in another thread: 
    http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/how-can-you-change-the-display-of-templates-in/d49194b9-a6b4-4768-8502-7d7b50e9dd65 working through this issue with Jay we were able to develop
    some VB script with handles a very large number of templates in a list view and it works much faster than the built-in Word interface.  The above thread is how I've worked around trying to define a shared template location and I am quite happy with it.

  • How do i copy content from one hard rive to another through my macbook air? the copy and paste option doesn't work

    How do i copy content from one hard rive to another through my macbook air? the copy and paste option doesn't work

    It's because of the extension of the hard drive is a Windows extension ( most likely MSDOS or Ex-FAT), meaning you can only read but not write. If there are no important files (or you can copy the whole thing to your computer/mac) you can just reformat the hard drive and change the extension to NTFS (readable and writable on both windows and mac) or Mac OS Extended (readable and writable on Mac, readable on windows).
    Go to DISK UTILITY
    Choose the Hard Disk you intended
    ERASE
    You can choose either
              (I personally prefer this one, you know just in case)

  • Can you restore from an older iCloud back up (July 3rd), and if it doesn't work RE restore from a new iCloud (July 14th)?

    I upgraded my 4S to a 5 on July 3. I had updated my back up to iCloud that morning (but it had also updated the night before). It did NOT restore from back up ANY games (I play one all the time and had a year and a half's worth of work in it!!!) But, I assumed it didn't do that, because it DID pull my contacts, though it didn't pull my email or my texts or anything. On July 13th I had to swap the 5 out for a new 5 because the first one was glitching. When I restored from back up this time (the date on it was July 12th) it pulled EVERYTHING!! I would like to try to reload the one from the 3rd to see if it will work now, but I hate to loose everything again! Can I load the 3rd's back up and if it doesn't work, RE load the back up from now? And even if I could do that, HOW do I do it?

    This is my boilerplate respone for the "waiting apps" problem. Give these suggestions a try in order.
    1. Tap the "waiting" icon and see if you can pause it. If it does pause, then tap it again and see if it will resume. If that works, repeat the same steps for each "waiting" icon.
    2. Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    3. Make sure that you do not have a stalled download in iTunes - if you have a download in there that did not finish, complete that one first.
    4. If that doesn't work - sign out of your account, restart the iPad and then sign in again.
    Settings>iTunes & App Store>Apple ID. Tap your ID and sign out. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Go back to Settings>iTunes & App Store>Sign in and then try to update again. Tap one waiting icon only if necessary to start the download stream.
    5. You can also try deleting the waiting icons - tap and hold down on an icon until it wiggles - the tap the X on the icon to delete it. Then try to download again. Apps may also be able to be deleted in Settings>General>Usage>Storage if you cannot get the X to pop up on the icon.
    6. You can try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered.
    7. If all else fails, download the updates or the apps in iTunes on your computer and then sync the content to your iPad.

  • Help - Font Book and font Library doesn't work

    I've just updated to a new iMac on Yosemite, and Font Book doesn't work. Neither does putting fonts into the "Library"
    There is a range of fonts that ARE working that are already in either place, but some (that worked up until two days ago in my old Mac running OS 10.6.8) just won't work.
    If I select the fonts in Font Book, Font Book doesn't load them. If I put them in the Library, they don't appear for use in any application.
    As a designer, updating fonts is essential, and if this can't be fixed I'm in serious trouble! So any advice welcome!

    We see posts like this here all the time. A person upgrades to a new OS, and Font Book suddenly stops working. Usually, the problem is that Font Book's database has been trashed by the upgrade with the very common symptoms you're seeing. You suddenly can't add fonts, and fonts Font Book says are open don't appear in some, or any apps.
    Restart your Mac and immediately hold down the Shift key when you hear the startup chime to boot into Safe Mode. Keep holding the Shift key until you see a progress bar towards the bottom of the screen. You can let go of the Shift key at that point. Yosemite is a bit different. Whether it's a Safe Mode boot or a normal one, you get the same progress bar. It just takes longer to get to the desktop in Safe Mode. So hold the Shift key until you get to the desktop.
    OS X asks you to log in (you will get this screen on a Safe Mode boot even if your Mac is set to automatically log in). Let the Mac finish booting to the desktop and then restart normally. This will clear Font Book's database and the cache files of the user account you logged into in Safe Mode.
    If that alone doesn't do it (it should), then clear out all of the font cache data.
    Close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:
    sudo atsutil databases -remove
    Terminal will then ask for your admin password. As you type, it will not show anything, so be sure to enter it correctly.
    This removes all font cache files. Both for the system and the current logged in user account. After running the command, close Terminal and immediately restart your Mac.

Maybe you are looking for