B
B
BakInRR2015-11-18 16:09:20
Database
BakInRR, 2015-11-18 16:09:20

How to work with ODBC in Ubuntu 15.04?

Trying to open a database
Selecting a *.mdb file I get an error
on Ubuntu 15.04

[unixODBC][Driver Manager]Data source name not found, and no default driver specified QODBC3: Unable to connect

Although:
DRIVERS : ("QSQLITE", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3")

The code:
bool DataModel::connectDB(const QString &dBName)
{
    db = QSqlDatabase::addDatabase("QODBC");
    qDebug() << "DRIVERS :" << QSqlDatabase::drivers();
    QString fullDBName = "DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=" + dBName;
    db.setDatabaseName(fullDBName);
    if (!db.open()) {
        logMessage( QString::fromLocal8Bit("Ошибка подключения к базе данных: ")
                   + db.lastError().text());
        return false;
    }
    return true;
}

Everything works fine on Windows, but it doesn't want to on Ubuntu.
How to set up ODBC for this, and is this the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2015-11-18
@BakInRR

Install mdbtools, convert data to normal format (SQL) and stop this perversion.
If you want it to be cross-platform, forget about MDB and master SQLite.

O
Oleg Tsilyurik, 2015-11-18
@Olej


Everything works fine on Windows, but it doesn't want to on Ubuntu.
How to set up ODBC for this, and is this the problem?
ODBC is a Windows offspring ... another crutch - why wouldn't it work?
Linux doesn't have ODBC support by default, it's foreign to it.
You need to install ODBC ... and then everything is the same: "E2 - E4 ...".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question