Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Turkish
  4. MySQL Bağlantı Sorunu
Qt 6.11 is out! See what's new in the release blog

MySQL Bağlantı Sorunu

Scheduled Pinned Locked Moved Unsolved Turkish
3 Posts 3 Posters 3.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Projeme bir library eklediğimde MySQL'e bağlanamıyorum.
    Örneğin çok basit bir console uygulaması:

    #include <QCoreApplication>
    #include <QSqlDatabase>
    #include <QDebug>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "deneme");
        db.setHostName("localhost");
        db.setDatabaseName(DB_NAME);
        db.setPort(DB_PORT);
    
        if (db.open(KULLANICI_ADI, SIFRE)) {
            qDebug() << "bağlandı";
            db.close();
        }else{
            qDebug() << "bağlantı HATASI";
        }
    
        return a.exec();
    }
    

    pro dosyası:

    QT += core sql
    QT -= gui
    
    TARGET = DbTest
    CONFIG += console
    CONFIG -= app_bundle
    
    TEMPLATE = app
    
    SOURCES += main.cpp
    
    

    Projeyi derleyip denediğimde sorun yok.
    Sonra, sadece pro dosyasına bir library ekliyorum ve derliyorum bu sefer DB'ye bağlanmıyor.
    Pro dosyasına şu satırı ekliyorum:

    LIBS += -L/usr/lib/i386-linux-gnu -lftd2xx
    

    Tek değişiklik bu satırın eklenmesi, başka tek bir satır değiştirilmiyor.
    Bunun herhangi bir mantıklı açıklaması olabilir?

    Not: DB bağlantısını iptal edip kütüphaneyi kullanabiliyorum. Yani kütüphanede herhangi bir sorun yok.

    1 Reply Last reply
    0
    • cagin90C Offline
      cagin90C Offline
      cagin90
      wrote on last edited by
      #2

      Dostum nasıl bir hata veriyor db'ye bağlanırken onuda yazabilirmisin

      1 Reply Last reply
      0
      • RovshanR Offline
        RovshanR Offline
        Rovshan
        wrote on last edited by
        #3

        Merhaba abi. Surda 2 sorun ola bilir.

        1. Senin MySQL Driver yok
        2. filr.pro de "QT+=sql" yok
          Hem #include <QtSql> yok abi, onlari elave et
          Turkcem iyi deyildi)
          Ey vallah ugurlar abi
        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved