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. QT SQLite with password
Forum Updated to NodeBB v4.3 + New Features

QT SQLite with password

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 4.5k Views 1 Watching
  • 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.
  • E Offline
    E Offline
    Enrique82
    wrote on 5 Feb 2018, 16:44 last edited by
    #1

    Hi, I'm starting with QT SQL. I can't open or create SQLite data base with password. I create the data base and table, but the data base is not protected and I can open whitout password.
    Also probe with mdataBase.setPassword("123"); and it does not work.

    QT SQLite supports password protection?

    QSqlDatabase mdataBase;
    mdataBase = QSqlDatabase::addDatabase("QSQLITE");
    mdataBase.setDatabaseName("h:\\bases\\dbasePW.sqlite");
    mdataBase.open("","123");    //user name "" / password"123"
    
    QString consulta;
    consulta.append("CREATE TABLE IF NOT EXISTS Persona("
                        "id INTEGER PRIMARY KEY AUTOINCREMENT,"
                        "nombre VARCHAR (100),"
                        "edad INGEGER NOT NULL"
                        ");");
    QSqlQuery crear;
    crear.prepare(consulta);
    crear.exec();
    
    

    Thanks Enrique

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 5 Feb 2018, 18:47 last edited by mrjj 2 May 2018, 18:47
      #2

      Hi
      Nope. Not as far as i know.
      https://stackoverflow.com/questions/5669905/sqlite-with-encryption-password-protection/5877130#5877130

      You must encrypt the database or else any tool will just open it.
      https://forum.qt.io/topic/37817/using-sqlcipher-in-place-of-sqlite
      or alternatively
      http://www.qtcentre.org/threads/35148-Building-QSQLITE-driver-with-AES-256

      1 Reply Last reply
      3

      1/2

      5 Feb 2018, 16:44

      • Login

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