Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Why can I get max 4096 characters of data from the database?



  • Hello everyone,

    I successfully connect to the database and can receive data, but I can receive data at maximum 4096 characters. What is the reason of this ? I would be happy if anyone help. Thank you .My code is below :

    QSqlDatabase db=QSqlDatabase::addDatabase("QODBC","myAwsomDatabase");
    db.setDatabaseName("DRIVER={FreeTDS};SERVER=192.168.1.39;PORT=1433;DATABASE=name,UID=name,PWD=name");
    
    if(db.open())
    {
    qDebug()<<"connected";
    }
    else
    {
    qDebug()<<"error";
    }
    
    QSqlQuery qry(db); // database query 
    
    
    if(qry.exec("select top 1 Base from Resto64 where respath=''"))
    {
    while(qry.next())
    {
    qDebug()<<qry.value(0);
    }
    }
    else
    {
    qDebug()<<db.lastError();
    }


  • Hi, FreeTDS 7.0+ has 4096 as the default packet size, that's probably why you get that many characters in one row.
    What happens if you change your query to "select top 2 Base from Resto64 where respath=''"?



  • Hi,

    Is there anyway to increase this packet size by any properties or is there any otherway to get more data except FreeTDS ?



  • Have you tried Microsoft's native Linux ODBC drivers (instead of FreeTDS)?



  • I took the data on multiple lines as it will take time to install different drivers. Thank you.


Log in to reply