I have local database, that I want to connect with. Here is my code, but unfortunately it doesn't work.
QString servername = "SYSDBA@localhost";
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName(servername);
db.setDatabaseName("Driver={InterBase ODBC driver};DATABASE=D:\\baza\\BAZA.fdb;");
db.setUserName("SYSDBA");
db.setPassword("masterkey");
if (db.open())
qDebug() << "Connected";
else
qDebug() << "Nope :(";
I would appreciate any help.
I finally got it. You have to set up your ODBC driver in windows: https://kb.brainwaregroup.com/operationsmanager/faces/kb/brainwaregroup%20kb/article/AA-00486
Then you can connect it directly using dsn configured in windows administrative tools:
QString servername = "localhost";
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName(servername);
db.setDatabaseName("YOUR_DSN_NAME");
db.setUserName("SYSDBA");
db.setPassword("masterkey");