Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why can I get max 4096 characters of data from the database?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 353 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.
  • M Offline
    M Offline
    Mucahit
    wrote on last edited by
    #1

    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();
    }
    
    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      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=''"?

      1 Reply Last reply
      3
      • M Offline
        M Offline
        Mucahit
        wrote on last edited by
        #3

        Hi,

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

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

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

          1 Reply Last reply
          4
          • M Offline
            M Offline
            Mucahit
            wrote on last edited by
            #5

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

            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