Ktmdwn, have you ever solve your problem? I have just like this problem.
Please, give your advise.![]()
Ktmdwn, have you ever solve your problem? I have just like this problem.
Please, give your advise.![]()
database name should looks like (in you case)
"(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.223)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = SSS)))"
ORACLE_HOME\NETWORK\ADMIN\ -- under windows.
as I know under Linux the same path, but check![]()
if you know ip-address of the server then you should ask the one who manage the server service name.![]()
Any progress on this one? After many tries I finally got the drivers working and now My code looks like this:
Qt Code:
db.setHostName("127.0.0.1"); db.setDatabaseName("dbname"); db.setPort(1521); db.setUserName("user"); db.setPassword("pass"); { // This happens if the driver is not available qFatal("No driver!"); } else if(!db.open()) { // The drivers work but the connection cannot be opened, print out why. } else { // Everything works, maybe. qDebug() << "Connection open!"; } db.close();To copy to clipboard, switch view to plain text mode
And my tnsnames.ora looks like this:
I can connect to database with the Oracle client but I am unable to do so with Qt. The host ip is something else than 127.0.0.1 in this case.Qt Code:
MYDB = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = dbname) ) )To copy to clipboard, switch view to plain text mode
With the code above I get (through line 14) ORA-12505 error:
"TNS:listener does not currently know of SID given in connect descriptor"
However, if I swap the parametres on lines 2 and 3 I get ORA-12545:
"Connect failed because target host or object does not exist"
I've understood that the db.setHostName has nothing to do with the connection, it is just to identify the connection within Qt, am I right?
What am I doing wrong here? Please someone spell it out for me.
Last edited by Ionwind; 2nd August 2010 at 12:34.
try to pass this line
into QSqlDatabase::setDatabaseName.
- MYDB =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = dbname)
- )
- )
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
I tried that too, it gives me different error: ORA-12145:
"TNS:could not resolve the connect identifier specified"
Any other ideas? : /
where did you try to set up connection: on linux or windows? did you try to connect to a database using the SqlBrowser from Qt demos directory?
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
I'm running on 32-bit Win XP, Qt Creator 2.0.0, on Qt 4.7.0. I've never tried out the SqlBrowser on the demos. Now when I tried it, I just got a message a through the application output after building: "The process could not be started!"
I solved my problem!
I connect to the database with the client with database name bar.foo and I tried to put that as parameter to QSqlDatabase::setDatabaseName() too. The connection, however, opened when I put there just foo (as in not bar.foo.
So the right values were following:
Qt Code:
db.setHostName("127.0.0.1"); // The TCP/IP of the host goes here db.setDatabaseName("foo"); // As suggested, the database name goes here :P db.setPort(1521); db.setUserName("user"); db.setPassword("pass");To copy to clipboard, switch view to plain text mode
Bookmarks