Results 1 to 5 of 5

Thread: QOCI plugin with Oracle RAC

  1. #1
    Join Date
    Dec 2009
    Posts
    65
    Thanks
    10
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default QOCI plugin with Oracle RAC

    I have successfully built QOCI plugin for Qt 4x on windows. Is there anyone that knows how to create connection to Oracle RAC (real application cluster)
    for example something similar exists in jdbc thin driver

  2. #2
    Join Date
    Oct 2009
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOCI plugin with Oracle RAC

    If you set up your TNSNAMES correctly (and/or use TNS_ADMIN to point to it), then a QT app compiled with QOCI will use it to connect to any Oracle database, RAC or single instance.

    Have you been able to connect to a database yet or is your question really "How do I code a connection to an Oracle Database?"

  3. The following user says thank you to BitRogue for this useful post:

    davidovv (30th September 2011)

  4. #3
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOCI plugin with Oracle RAC

    If the client is correctly configured (TNSNAMES), you have to specify only databaseName (Service Name in ORACLE), userName and Password.

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase ("QOCI");
    2. db.setDatabaseName ("my_service");
    3. db.setUsername ("my_user");
    4. db.setPassword ("my_password");
    5.  
    6. if (db.open()) {
    7. // Connection Open
    8. }
    To copy to clipboard, switch view to plain text mode 

    For security reason you may prefer

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase ("QOCI");
    2. db.setDatabaseName ("my_service");
    3.  
    4. if (db.open("my_user", "my_password")) {
    5. // Connection Open
    6. }
    To copy to clipboard, switch view to plain text mode 

    because this QSqlDatabase::open() version doesn't store the password.
    A camel can go 14 days without drink,
    I can't!!!

  5. The following user says thank you to mcosta for this useful post:

    davidovv (30th September 2011)

  6. #4
    Join Date
    Dec 2009
    Posts
    65
    Thanks
    10
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QOCI plugin with Oracle RAC

    I connected succesfuly to database using its IP address....

    Maybe these next questions are more oracle questions, and not for this thread but still...

    what are the requirements for tnsnames, is oracle instantclient enough, or i need to install that 500mb client or even more?

    Another question, is this RAC invisible to my application? For example after db.open i execute one query, it gets executed on one node, then that node fails, i execute another query. Is this second query executed on second node without any notification to my application (maybe just some delay), or I need to reconnect to db and to try again?

    And thank you both, it is useful information that RAC connection can't be configured within my application only, more things need to be done.

  7. #5
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOCI plugin with Oracle RAC

    instantclient is enough for you.

    I think you have to reconnect when a node fails (OCI connections are TCP connections).
    A camel can go 14 days without drink,
    I can't!!!

  8. The following user says thank you to mcosta for this useful post:

    davidovv (30th September 2011)

Similar Threads

  1. Replies: 0
    Last Post: 27th May 2011, 10:12
  2. Pb connexion distant oracle database using QOCI
    By mourad in forum Qt Programming
    Replies: 0
    Last Post: 16th December 2010, 11:52
  3. how to deploy qt based application with oracle plugin
    By kaycee1 in forum Installation and Deployment
    Replies: 1
    Last Post: 28th October 2010, 18:02
  4. OCI(oracle)driver adding to plugin
    By jjbabu in forum Qt Programming
    Replies: 0
    Last Post: 22nd April 2009, 13:04
  5. QOpenOCCI Oracle SQL Plugin
    By a_white in forum Qt-based Software
    Replies: 19
    Last Post: 13th March 2009, 09:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.