⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Error in connection of SQL Server in network

  • I created an application that accesses SQL Server on my machine, and it worked correctly.But when I use a machine on a network, seguite displays the error:

    [Microsoft][ODBC Driver Manager]Data source name not found and no default driver specified QODBC3: unable to connect.

    Already configured the SQL Server installed on the server and the SQL Server Management Studio to test the communication, that is okay.

    the source code:

    db = QSqlDatabase::addDatabase("QODBC");
    dsn = QString("DRIVER={SQL Native Client};SERVER=%1;DATABASE=%2;PORT=1433;UID=cliente;PWD=12345;").arg(servername).arg(dbname);

    QMessageBox::critical(this,"Erro Conexão!","Não foi possivel realizar a conexão \n com o banco de dados!\n"+db.lastError().text(), "OK");

    What can I do to solve?

Log in to reply