PDA

View Full Version : QOCI plugin with Oracle RAC



davidovv
5th July 2011, 19:09
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

BitRogue
6th July 2011, 11:48
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?"

mcosta
6th July 2011, 11:56
If the client is correctly configured (TNSNAMES), you have to specify only databaseName (Service Name in ORACLE), userName and Password.



QSqlDatabase db = QSqlDatabase::addDatabase ("QOCI");
db.setDatabaseName ("my_service");
db.setUsername ("my_user");
db.setPassword ("my_password");

if (db.open()) {
// Connection Open
}


For security reason you may prefer



QSqlDatabase db = QSqlDatabase::addDatabase ("QOCI");
db.setDatabaseName ("my_service");

if (db.open("my_user", "my_password")) {
// Connection Open
}


because this QSqlDatabase::open() version doesn't store the password.

davidovv
7th July 2011, 11:41
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.

mcosta
7th July 2011, 11:54
instantclient is enough for you.

I think you have to reconnect when a node fails (OCI connections are TCP connections).