PDA

View Full Version : Opening database problems (QODBC + WIN7 + QT4 10.05 QT )



Bromske
27th February 2011, 14:39
Hello,

i want to open a sql-server database, but it dosn't work ;(

qDebug() << QSqlDatabase::drivers();
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
qDebug() << db.lastError();

with the result:

("QSQLITE", "QODBC3", "QODBC")
QSqlError(-1, "", "")

when i try to open the database with valid data

QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName("127.0.0.1");
db.setDatabaseName("abr3");
db.setUserName("sa");
db.setPassword("");
db.open();

qDebug() << db.lastError().text();

i get the "Driver not loadedDriver not loaded" error :(

I've searched with google, in this Forum, but nothing works...

I can create a valid dsn, i can connect to the database with other Query-tools
but please,

can someone give me some tips, what i must do, to create a connection with Qt4

marco