Seite 1 von 1

QT4: ORACLE Datenbankzugriff ueber ODBC unter Linux

Verfasst: 31. Oktober 2007 15:06
von nando
Hi,

hat jemand schon mal einen Datenbankzugriff auf eine ORACLE Datenbank mit QT4.3.x und unixODBC realisiert ?

Ich habe folgenden Code:

Code: Alles auswählen

	if(!QSqlDatabase::isDriverAvailable("QODBC")) {
		DTG_FATAL("QODBC database module not available.");
		return false;
    }
	
	m_db = QSqlDatabase::addDatabase("QODBC", "odbc connection");

    m_db.setDatabaseName(odbcDataSource);


	QStringList driverList = m_db.drivers();
	
	for(int i=0; i<driverList.size(); ++i) {
		DTG_DEBUG("driver [" << i << "]: " << driverList[i].toStdString());
	}
	

    if(!m_db.open()) {
		DTG_FATAL("Couldn't connect to database Error[" <<
				  m_db.lastError().text().toAscii().data() << "]");
		return false;
    }

    DTG_MESSAGE("ORACLE_DBConnector::initializing: connected succesfully to [" << 
				odbcDataSource.toStdString() << "]");
Als ODBC Source hab ich:

Code: Alles auswählen

 DRIVER=oracle;SERVER=localhost;DATABASE=tfdpstest;UID=;PWD=tfdps
Ich erhalte immer folgende Fehlermeldung:

Code: Alles auswählen

<31.10. 14:54:10.741870><DBG><ORACLE_DBConnector.cpp:47>[driver [0]: QSQLITE]
<31.10. 14:54:10.741942><DBG><ORACLE_DBConnector.cpp:47>[driver [1]: QODBC3]
<31.10. 14:54:10.742002><DBG><ORACLE_DBConnector.cpp:47>[driver [2]: QODBC]
<31.10. 14:54:10.763865><FAT><ORACLE_DBConnector.cpp:53>[Couldn't connect to database Error[ [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed QODBC3: Unable to connect]]


Was macht das QODBC3 da?????
Und was ist mit Driver's SQLAllocHandle on SQL_HANDLE_HENV failed QODBC3 gemeint ???


Gruss,
Nando