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. Problem with Query - QODBC, Informix
QtWS25 Last Chance

Problem with Query - QODBC, Informix

Scheduled Pinned Locked Moved Solved General and Desktop
qodbcinformixquery
15 Posts 4 Posters 6.7k 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.
  • O Offline
    O Offline
    ObiWan
    wrote on 10 Jan 2016, 16:00 last edited by
    #6

    Have you noticed the end of th query:

    INSERT INTO ... VALUES(?, ?, ?, ?, ?)
    
    

    I aks, because there is no line break and it's not visible.

    M 1 Reply Last reply 10 Jan 2016, 16:03
    0
    • O ObiWan
      10 Jan 2016, 16:00

      Have you noticed the end of th query:

      INSERT INTO ... VALUES(?, ?, ?, ?, ?)
      
      

      I aks, because there is no line break and it's not visible.

      M Offline
      M Offline
      Mich.Q
      wrote on 10 Jan 2016, 16:03 last edited by Mich.Q 1 Oct 2016, 16:08
      #7

      @ObiWan
      Yes, I just copied your code to mine.
      void pacjenci_window::on_dodaj_clicked()
      {
      QSqlQuery uQuery = QSqlQuery(db);
      uQuery.prepare("INSERT INTO pacjent(nr_ubezpieczenia, imie_pacjenta, nazwisko_pacjenta, adres_pacjenta, telefon_pacjenta) VALUES(?, ?, ?, ?, ?)");
      uQuery.bindValue(0 ,ui->nr_ub->text());
      uQuery.bindValue(1 ,ui->imie->text());
      uQuery.bindValue(2 ,ui->nazwisko->text());
      uQuery.bindValue(3 ,ui->adres->text());
      uQuery.bindValue(4 ,ui->nr_tel->text());
      uQuery.exec();
      sQuery.prepare("SELECT * FROM pacjent");
      if(!sQuery.exec()){
      qDebug() << uQuery.lastError().text() << " DODAJ BUTTON select";
      }
      sQuery.last();
      FillForm();
      }
      @added qDebug to uQuery too, new error:
      QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement."
      "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement. QODBC3: Unable to execute statement" DODAJ BUTTON insert

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ObiWan
        wrote on 10 Jan 2016, 16:11 last edited by
        #8

        Qt docu says:
        QString stores a string of 16-bit QChars, where each QChar corresponds one Unicode 4.0 character.

        Informix is old and I suppose cannot handle Unicode.
        Try toStdString() or toLocal8Bit() to bind values.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mich.Q
          wrote on 10 Jan 2016, 16:22 last edited by Mich.Q 1 Oct 2016, 16:33
          #9

          toStdString() - error:
          C:\Users\michu\Documents\przychodnia_projekt\pacjenci_window.cpp:60: błąd: no matching function for call to 'QSqlQuery::bindValue(int, std::string)'
          uQuery.bindValue(1 ,ui->imie->text().toStdString());
          ^
          Trying to add additional variables with toStdString() and then add them to bindvalue by name but dont work too.

          toLocal8bit() - the same error as on begin:
          QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement."
          "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement. QODBC3: Unable to execute statement" DODAJ BUTTON insert

          @edit:
          trying with toUtf8() - same error like above.
          with toWCharArray() - same error like toStdString()

          @edit
          for toStdString() & toUtf8 I added data() but now error is the same like for others...

          uQuery.bindValue(1 ,ui->imie->text().toUtf8().data());

          error:
          QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement."
          "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement. QODBC3: Unable to execute statement" DODAJ BUTTON insert

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mich.Q
            wrote on 10 Jan 2016, 20:05 last edited by
            #10

            Yes! I found solution. Its simply uncheck option Insert Coursor in ODBC IBM driver config...
            Like on picture:
            https://img42.com/r4DZU
            Thanks guys for support.

            1 Reply Last reply
            1
            • E Offline
              E Offline
              erick joshua
              wrote on 7 Feb 2018, 06:58 last edited by
              #11

              hi,@Mich-Q ,i'm new about qt and informix, i need informix driver,can you sent it to me.if it is win32,it is better,can you?my english is terrible-.-。thank you.

              M 1 Reply Last reply 7 Feb 2018, 07:25
              0
              • E erick joshua
                7 Feb 2018, 06:58

                hi,@Mich-Q ,i'm new about qt and informix, i need informix driver,can you sent it to me.if it is win32,it is better,can you?my english is terrible-.-。thank you.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 7 Feb 2018, 07:25 last edited by
                #12

                @erick-joshua

                Hi and welcome to the forums
                you can use ODBC for connecting Qt to informix server.
                As far as i know there is no native Qt driver for informix.

                https://www.ibm.com/developerworks/data/library/techarticle/dm-1108odbcdrivermanager/index.html

                Sorry I dont its download link.

                E 1 Reply Last reply 7 Feb 2018, 13:30
                0
                • M mrjj
                  7 Feb 2018, 07:25

                  @erick-joshua

                  Hi and welcome to the forums
                  you can use ODBC for connecting Qt to informix server.
                  As far as i know there is no native Qt driver for informix.

                  https://www.ibm.com/developerworks/data/library/techarticle/dm-1108odbcdrivermanager/index.html

                  Sorry I dont its download link.

                  E Offline
                  E Offline
                  erick joshua
                  wrote on 7 Feb 2018, 13:30 last edited by
                  #13

                  @mrjj hi,i know there is no native qt driver for informix.when i saw this topic ,i find https://img42.com/r4DZU,there is a dialog which title is "ibm informix odbc driver setup", i think you have the informix odbc driver...
                  i guess you dont have informix odbc driver,is that right?

                  M 1 Reply Last reply 7 Feb 2018, 13:47
                  0
                  • E erick joshua
                    7 Feb 2018, 13:30

                    @mrjj hi,i know there is no native qt driver for informix.when i saw this topic ,i find https://img42.com/r4DZU,there is a dialog which title is "ibm informix odbc driver setup", i think you have the informix odbc driver...
                    i guess you dont have informix odbc driver,is that right?

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 7 Feb 2018, 13:47 last edited by
                    #14

                    @erick-joshua
                    Yes, Qt do not come with ODBC drivers. They are supplied by the vendors or microsoft.
                    Oddly i cannot find a download link at IBM.
                    Even other pages mention it
                    http://www.ciscounitytools.com/Applications/CxN/InformixODBC/InformixODBC.html
                    This seems to be the SDK
                    http://www.ciscounitytools.com/Applications/CxN/InformixODBC/clientsdk.4.10.TC7DE.WIN.zip
                    but i have no idea what version of the actual server it works with etc.

                    E 1 Reply Last reply 7 Feb 2018, 14:57
                    1
                    • M mrjj
                      7 Feb 2018, 13:47

                      @erick-joshua
                      Yes, Qt do not come with ODBC drivers. They are supplied by the vendors or microsoft.
                      Oddly i cannot find a download link at IBM.
                      Even other pages mention it
                      http://www.ciscounitytools.com/Applications/CxN/InformixODBC/InformixODBC.html
                      This seems to be the SDK
                      http://www.ciscounitytools.com/Applications/CxN/InformixODBC/clientsdk.4.10.TC7DE.WIN.zip
                      but i have no idea what version of the actual server it works with etc.

                      E Offline
                      E Offline
                      erick joshua
                      wrote on 7 Feb 2018, 14:57 last edited by
                      #15

                      @mrjj thank you still

                      1 Reply Last reply
                      1

                      • Login

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