testDB.pro
QT += core gui sql
unix: LIBS += -lodbc
#unix: LIBS += -lsybdb
win32: LIBS += -lodbc32
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testBD
TEMPLATE = app
SOURCES += main.cpp
main.cpp
#include <QApplication>
#include <QDebug>
#include <qsqldatabase.h>
#include <QSqlError>
#include <QTime>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSqlDatabase db;
db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={SQL Server};Server=1.1.1.1;DATABASE=Obmen");
db.setUserName("user");
db.setPassword("password");
db.setConnectOptions("SQL_ATTR_LOGIN_TIMEOUT=1");
QTime t; t.start();
db.open();
qDebug()<<t.elapsed()*0.001;
return 0;//a.exec();
}
вывод 47.523
p.s. 66, 67 - 68секунд, 68 - 89секунд, 90 - 116. 400 - 419секунд