Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. database
    Log in to post

    • SOLVED QSQLITE app no connect to database after deploy
      General and Desktop • database deploy qsqlite • • Piotrek102  

      13
      0
      Votes
      13
      Posts
      48
      Views

      @Piotrek102 said in QSQLITE app no connect to database after deploy: But what I sent you is not the main application file. It's part of the class I wrote It doesn't matter. What @JonB wrote applies.
    • UNSOLVED Architectural advice ... DB, Server, REST Api and Qt Apps
      General and Desktop • database rest m2m • • Heinz  

      7
      0
      Votes
      7
      Posts
      56
      Views

      Regarding your stack : Internet server with Windows : I really think Windows really have no added value in this area. Installing a DBMS like MySQL or MSSQL : you might be interested in NoSQL kind of database as you probably have limited relations between your data. I think some database also integrate out of the shelves a Rest or Curl API, at least that used to be the case with couchDb for instance No direct access to the database from outside for safety reasons Instead writing an API that runs on the server and allows indirect DB Access via predefined (HTTP?) Requests. if possible, aim for HTTPS right from the start. Regarding the authentification, for a pet project I have been relying on Wordpress to manage user management through REST, I am not sure tough it is actually a good solution but at least it is cheap and quite easy to set up.
    • SOLVED SQLite database creation
      General and Desktop • mysql database qsqlite sqllite • • Giggon  

      6
      0
      Votes
      6
      Posts
      83
      Views

      @Giggon said in SQLite database creation: Thread to be closed Please go and mark the post as solved. Thanks
    • UNSOLVED QTabWidget, how to load some data in QScrollArea from a database inside QTabWidget
      General and Desktop • database sqlite qtabwidget qscrollarea • • moslehuddin  

      2
      0
      Votes
      2
      Posts
      66
      Views

      @moslehuddin You should be more precise when asking a question. What exactly are you asking? How to get data from a database? How to show it? Both? How to use QScrollArea? Qt SQL: https://doc-snapshots.qt.io/qt5-5.14/qtsql-index.html How to show the data: https://doc.qt.io/qt-5/qsqltablemodel.html and https://doc.qt.io/qt-5/qtableview.html How to use QScrollArea: https://doc.qt.io/qt-5/qscrollarea.html
    • SOLVED Building QT with "windeployqt": not connect to database (ODBC)
      Installation and Deployment • database build odbc windeployqt • • AndreaCT  

      24
      0
      Votes
      24
      Posts
      162
      Views

      @JSher said in Building QT with "windeployqt": not connect to database (ODBC): Its connecting to an OBDC entry in windows by the looks of it. I do not use ODBC much but the way I understand it is you have to make the entry on each machine....Thats why I use the standard mysql connector, then you do not. I could be off:) Ok thank you very much!!! I evaluate the transition to the mysql connector
    • Problem with SQLite Database and threads "Database is locked"
      General and Desktop • database thread • • davidesalvetti  

      14
      0
      Votes
      14
      Posts
      1429
      Views

      @davidesalvetti Hmm, I am not very confident in your solution. I would create a helper class to create/use right connection according to current thread. Something like this (it is just a skeleton, not sure it is working as it is): #include <QSqlDatabase> #include <QThread> class MyBDConnection { QString m_dbPath; QString m_dbName; Q_DISABLE_COPY(MyBDConnection) public: explicit MyBDConnection(const QString &sqlitePath, const QString &cnxName): m_dbPath(sqlitePath), m_dbName(cnxName) {} QSqlDatabase getDBConnection() { // Starting with Qt 5.11, sharing the same connection between threads is not allowed. // Use a dedicated connection for each thread requiring access to the database, // using the thread address as connection name. QSqlDatabase cnx; QString dbName = QStringLiteral("%1_%2").arg(m_dbName).arg(qintptr(QThread::currentThreadId()), 0, 16); if(QSqlDatabase::contains(dbName)) { cnx = QSqlDatabase::database(dbName); } else { cnx = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), dbName); cnx.setDatabaseName(m_dbPath); if (!cnx.isValid() || !cnx.open()) { qDebug() << "DB connection creation error!"; } } return cnx; } } And the only create on instance of this class and pass the pointer to each class which need connection to DB.
    • SOLVED Showing data from multiple SQLite tables
      General and Desktop • database model-view sqlite view • • Pl45m4  

      7
      0
      Votes
      7
      Posts
      750
      Views

      @Christian-Ehrlicher Hm ok... That's not what I wanted to hear :D Thank you anyway. I think, I will subclass QSqlQueryModel then and write functions to make the model writable...
    • SOLVED cannot execute queries on a database
      General and Desktop • database qtsql • • user4592357  

      8
      0
      Votes
      8
      Posts
      642
      Views

      @EdwinSA said in cannot execute queries on a database: but the queries are not running And what does this mean? btw: QSqlQuery has some functions to get the error string - you should use them.
    • SOLVED How to share database connection parameters between multiple QSqlTableModel objects?
      QML and Qt Quick • database qsqltablemodel qsqldatabase models model binding • • ivarec  

      6
      0
      Votes
      6
      Posts
      573
      Views

      From the looks of it, you have to re-create the models when you change these settings.
    • SOLVED what is the correct way to implement a Database class in a application
      General and Desktop • qt5.5 database desktop sqlite • • realhamidrezakp  

      10
      0
      Votes
      10
      Posts
      952
      Views

      What do you mean by modify the model ? i mean updating model , like a search window that needs to update model every time user change input. You can see how to handle QtSQL models and views in the QtSQL modules examples. i saw it, and figure out some of examples. but i need to read more about MVC in qt. thanks you.
    • UNSOLVED check date called from firebase against calendar?
      General and Desktop • qml database calendar firebase date • • Ldweller  

      10
      0
      Votes
      10
      Posts
      1048
      Views

      @mrjj I have moved forward from calling my saved dates to receive the following: Read Value: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] for key: dates (one for each date saved) when adding if(success) { console.log(JSON.stringify(value)) } I can also read the saved dates in the format of: [{"date":"2018-10-01T21:17:00.926"},{"date":"2018-10-02T12:00:00.000"},{"date":"2018-10-03T12:00:00.000"},{"date":"2018-10-06T12:00:00.000"},{"date":"2018-10-07T12:00:00.000"},{"date":"2018-10-08T12:00:00.000"}] now how would I determine these dates are saved in my calendar to add the marker? I have tried adding a property bool to the marker so the read value equals isMarked = true yet this either marks every date on the calendar or none at all depending on how I am working this?!? How would I convert the JSON string to individual date reads?
    • UNSOLVED QMYSQL driver not loaded in os windows
      Persian • c++ mysql database qt5.9 • • javad935  

      3
      0
      Votes
      3
      Posts
      1534
      Views

      I have add C:\mysql\mysql-5.7.21-winx64\lib into path variable. but don't work!
    • SOLVED Best approach to create a media library
      General and Desktop • sql database qtmultimedia music • • Euclide  

      3
      0
      Votes
      3
      Posts
      826
      Views

      @mrjj Many thanks mrjj for your answer. I'll make more researches about SQLite and Taglib.
    • UNSOLVED How do you persist and update your models?
      QML and Qt Quick • database model • • tskardal  

      4
      0
      Votes
      4
      Posts
      961
      Views

      @tskardal said in How do you persist and update your models?: I'm thinking that the goal is having "plain" models that are not QObjects. That's a quite normal thing to do. Let the Qt model be just an intermediary between actual data model/tree and the GUI. If your implementation works, then it's OK I guess. I'm not sure if there any actual question to answer here :-)
    • SOLVED QtRpt report from Databse
      QML and Qt Quick • qt creator database qtrpt • • Neel 0  

      8
      0
      Votes
      8
      Posts
      2022
      Views

      @Neel-0 Hey Bro Can You Share This Code ? I am working on Report from the last three Days help Me Brother
    • SOLVED Connection to a MySQL database with Qt Creator on Windows
      General and Desktop • qtcreator database mysql • • Justin_Ahinon  

      11
      0
      Votes
      11
      Posts
      5454
      Views

      Hi, Are you aware of the implications of moving from MySQL to SQLite ? One of which is: you are using a relative path for your SQLite database which won't work if your users install your application in e.g. Program Files as it's a read-only location.
    • UNSOLVED Getting database values into QStringList
      General and Desktop • qtcreator database qstringlist value • • Lasith  

      3
      0
      Votes
      3
      Posts
      1967
      Views

      Hi, To add to @dream_captain, in case of an error, at least print the error string from the query so you know what went wrong.
    • UNSOLVED Is there any way to use Apollo graphql client with qt, qtquick/qml ?
      3rd Party Software • database videoplayback swift apollo graphql • • Kjetil  

      1
      1
      Votes
      1
      Posts
      1343
      Views

      No one has replied

    • UNSOLVED Which system do you recommend for cloud based realtime database?
      Brainstorm • database cloud realtime iot • • ideadesigner  

      4
      0
      Votes
      4
      Posts
      1154
      Views

      The most compatible with qt is GE Predix (https://www.predix.io/) - https://github.com/IndeemaSoftware/QPredix
    • SOLVED Making Qtableview cell autosize
      General and Desktop • qtableview database autosize retrieve • • Kushan  

      4
      0
      Votes
      4
      Posts
      924
      Views

      @Kushan Or you can use resizeColumnsToContents() method for the same.
    • UNSOLVED Looking for the best multithreading patterns for database access
      General and Desktop • signal & slot database multithreading • • abforce  

      9
      0
      Votes
      9
      Posts
      2724
      Views

      @abforce said in Looking for the best multithreading patterns for database access: For this purpose can I employ a callback pattern? You can simply use signals/slots across threads
    • SOLVED Accessing the same Database from different threads
      General and Desktop • database sqlite thread • • davidesalvetti  

      3
      0
      Votes
      3
      Posts
      953
      Views

      @SGaist Thank you for your answer!
    • SOLVED QSqlDatabasePrivate::addDatabase: duplicate connection name 'MyConnection' error
      General and Desktop • c++ qtcreator database runtime error • • Lasith  

      2
      0
      Votes
      2
      Posts
      1188
      Views

      @Lasith You should open the database only once. Currently you do it each time button is pressed.
    • UNSOLVED Using single global object to access database
      General and Desktop • c++ qtcreator database global • • Kushan  

      3
      0
      Votes
      3
      Posts
      1963
      Views

      Hi, There's no need for any global objects all the more if you only have one active connection for your application but it's also valid if you are managing multiple connections. The QSqlDatabase class already provides everything you need. Like written in the documentation, if you are only using one connection, don't give it a name, it will become the default connection and all the SQL related classes will use it by default. If you have several connections, it's easy to retrieve the one you are interested in by using QSqlDatabase::database. On a side note, you should properly test the outcome of your open call. Right now it could be failing and you don't care about that possibility.
    • UNSOLVED connecting to database when a form loads using signals and slots
      General and Desktop • qtcreator signal & slot database forms • • Lasith  

      4
      0
      Votes
      4
      Posts
      954
      Views

      @mostefa said in connecting to database when a form loads using signals and slots: I think that this post is duplicate Strictly speaking it isn't, although it's quite similar.
    • SOLVED QSqlQuery::prepare: database not open
      General and Desktop • qtcreator database qoci open • • Lasith  

      7
      0
      Votes
      7
      Posts
      1471
      Views

      @mostefa Thanx mate
    • UNSOLVED Qt Quick database for MySQL or Postgresql
      QML and Qt Quick • qml mysql database sqlite postgresql • • mbnoimi  

      1
      0
      Votes
      1
      Posts
      664
      Views

      No one has replied

    • SOLVED Selecting a database while using QSqlTableModel
      General and Desktop • sql database qsqltablemodel • • spektro37  

      8
      0
      Votes
      8
      Posts
      2537
      Views

      @spektro37 Well its used with all QWidgets so would make sense. Its something to be aware of when creating GUI and also the little note that any QWidget that are not given a owner/parent, will become a window. That can be surprised when coming from other frameworks. Say you make a new label QLabel *lab= new QLabel(); Since its given no parent, it will become a window. That was pretty surprising to me first time as i wanted to insert it into the main window. So its good to know about.
    • UNSOLVED Pireal 2.0.2 - Educational tool for working with RA
      Announcements • qml qt5 python database pyqt • • gabodev  

      1
      0
      Votes
      1
      Posts
      538
      Views

      No one has replied

    • QxOrm 1.4.3 and QxEntityEditor 1.2.1 released : support CMake and new QxEntityEditor documentation
      Announcements • sql cmake database serialization orm • • qxorm  

      1
      0
      Votes
      1
      Posts
      1437
      Views

      No one has replied

    • UNSOLVED Database table transfer over TCP
      General and Desktop • database tcpsocket qt 5.7.0 data transfer • • DoughBoy  

      21
      0
      Votes
      21
      Posts
      6785
      Views

      @DoughBoy The following SQL, with the Chinook test database open will create a new file in the same directory named 'out.sqlite' holding all of the album information for artist 51 with the original table layout. A Qt model is totally unnecessary. Just run the query and it will create your file. From there you can compress it and ship it. ATTACH DATABASE 'out.sqlite' AS outdb; CREATE TABLE outdb.album AS SELECT * from album WHERE ArtistId = 51; DETACH DATABASE outdb; It does use SQLite specific sql. Note especially that the ATTACH DATABASE and DETACH DATABASE are sql to be sent to the database just like the CREATE TABLE.. BTW, I have never done this using Qt, only in batch files, but I see no reason for it not to work both ways. Mike
    • UNSOLVED Change value in table view in spin box
      General and Desktop • c++ qt 5.7 database spinbox tablview • • ronyNS  

      4
      0
      Votes
      4
      Posts
      1114
      Views

      // QSpinBox* mySpinBox; //QSqlQueryModel *model; // int rowIndex,colIndex; QObject::connect(mySpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),[model,rowIndex,colIndex](int val)->void{ model->setValue(model->index(rowIndex,colIndex),val); });
    • UNSOLVED Load Image From Db Problem
      General and Desktop • database problem loading images • • M4RZB4Ni  

      26
      0
      Votes
      26
      Posts
      7754
      Views

      @VRonin Thank you for reply, but my problem is the load image from database, please see my another question: QT 5.8 image from database error
    • SOLVED Save Graphic scene in Database
      General and Desktop • database save graphics scene • • M4RZB4Ni  

      12
      0
      Votes
      12
      Posts
      2916
      Views

      @mrjj Thanks a lot Brother :) My Problem Solved!
    • UNSOLVED Connecting access database to Qt
      General and Desktop • database access • • ronyNS  

      3
      0
      Votes
      3
      Posts
      842
      Views

      Have you tryed axcontainer? Please try this. It this application works for you I can help you. http://www.denisgottardello.it/ADOTest/index.php
    • SOLVED Bind Qlable to Sqlserver Database
      General and Desktop • database bind sqlserver qlable • • M4RZB4Ni  

      3
      0
      Votes
      3
      Posts
      889
      Views

      hi You can use http://doc.qt.io/qt-5/qdatawidgetmapper.html to insert data to label. It can not be directly tied to a model.