diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index cde56459c4a..ae13f9eb6a0 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -1968,7 +1968,7 @@ bool QODBCDriver::open(const QString & db, connQStr = "FILEDSN="_L1 + ensureEscaped(db); else if (db.contains("DRIVER="_L1, Qt::CaseInsensitive) || db.contains("SERVER="_L1, Qt::CaseInsensitive)) - connQStr = ensureEscaped(db); + connQStr = db; else connQStr = "DSN="_L1 + ensureEscaped(db); diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index 8593233d1b4..4cc5b0d0506 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -404,15 +404,20 @@ of the ODBC driver. ODBC support can be used as a fallback for compliant databases if no native driver is available. - On Windows, an ODBC driver manager should be installed by default. + On Windows, an ODBC driver manager is installed by default. For Unix systems, there are some implementations which must be installed first. Note that every end user of your application is required to have an ODBC driver manager installed, otherwise the QODBC plugin will not work. When connecting to an ODBC datasource, you should pass the name - of the ODBC datasource to the QSqlDatabase::setDatabaseName() + of the ODBC datasource (DSN) to the QSqlDatabase::setDatabaseName() function, rather than the actual database name. + It's also possible to pass a FILEDSN (*.dsn) filename or a complete + ODBC driver string. When passing a driver string you must make sure, + that all parameters (username, password, ...) are properly escaped. + Passing the username or password through the QSqlDatabase functions, + the escaping is done by the QODBC plugin. The QODBC Plugin needs an ODBC compliant driver manager version 2.0 or later. Some ODBC drivers claim to be version-2.0-compliant,