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. Error SQLCE database
QtWS25 Last Chance

Error SQLCE database

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 758 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.
  • A Offline
    A Offline
    AnthonyQt
    wrote on last edited by
    #1

    Hi everyone,

    I have a problem when I want to connect to my sdf database
    This is my code
    6e90115e-fe91-44e4-8c2d-7dad3460cd62-image.png

    I try with

    db.setDatabaseName("Data Source=F:\data.sdf;Persist Security Info=False;")

    But with this two case I have the same error :
    QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

    Do you have an idea?
    Thank in advance

    JonBJ 1 Reply Last reply
    0
    • A AnthonyQt

      Hi everyone,

      I have a problem when I want to connect to my sdf database
      This is my code
      6e90115e-fe91-44e4-8c2d-7dad3460cd62-image.png

      I try with

      db.setDatabaseName("Data Source=F:\data.sdf;Persist Security Info=False;")

      But with this two case I have the same error :
      QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

      Do you have an idea?
      Thank in advance

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @AnthonyQt said in Error SQLCE database:

      db.setDatabaseName("Data Source=F:\data.sdf;Persist Security Info=False;")

      Just to be sure, like your original code you do use \\ here in your code, don't you?

      db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")
      
      1 Reply Last reply
      1
      • A Offline
        A Offline
        AnthonyQt
        wrote on last edited by AnthonyQt
        #3

        @JonB said in Error SQLCE database:

        s

        I have the same error :/

        db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")

        Give my QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

        jsulmJ JonBJ 2 Replies Last reply
        0
        • A AnthonyQt

          @JonB said in Error SQLCE database:

          s

          I have the same error :/

          db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")

          Give my QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #4

          @AnthonyQt @JonB already told you that you should use \\ instead of \ , so please change the path accordingly...
          \ is escape character in C/C++.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • A AnthonyQt

            @JonB said in Error SQLCE database:

            s

            I have the same error :/

            db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")

            Give my QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @AnthonyQt
            You can see your pasted code still shows

            "Data Source=F:\data.sdf;Persist Security Info=False;"
            

            Meanwhile your original screenshot showed you using "F:\\data.sdf".

            Please learn to use the forum's Code tags to show your code correctly, then we would know.

            Is it too hard to answer my question about whether you have \ or \\ in your string?

            UPDATE I believe you have now edited your earlier post to change. Use Code tags! Who knows....

            A 1 Reply Last reply
            1
            • JonBJ JonB

              @AnthonyQt
              You can see your pasted code still shows

              "Data Source=F:\data.sdf;Persist Security Info=False;"
              

              Meanwhile your original screenshot showed you using "F:\\data.sdf".

              Please learn to use the forum's Code tags to show your code correctly, then we would know.

              Is it too hard to answer my question about whether you have \ or \\ in your string?

              UPDATE I believe you have now edited your earlier post to change. Use Code tags! Who knows....

              A Offline
              A Offline
              AnthonyQt
              wrote on last edited by
              #6

              @JonB

              I have \\

              56dc104c-3268-42ef-b6b1-8e67d7566fc8-image.png

              But same error

              JonBJ 1 Reply Last reply
              0
              • A AnthonyQt

                @JonB

                I have \\

                56dc104c-3268-42ef-b6b1-8e67d7566fc8-image.png

                But same error

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @AnthonyQt
                Then if it works without Persist Security Info=False; (please verify), I can only assume that SQLCE ODBC driver does not like that parameter.....

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  AnthonyQt
                  wrote on last edited by
                  #8

                  c3d67e20-46f2-4ec6-b525-3880bb2cff59-image.png
                  724a81e5-447d-413d-a344-ac047f1babb8-image.png

                  I made this but I have the same error
                  QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

                  02bc3100-29bc-4840-8a33-9db382857f7f-image.png
                  But this give my true

                  JonBJ 1 Reply Last reply
                  0
                  • A AnthonyQt

                    c3d67e20-46f2-4ec6-b525-3880bb2cff59-image.png
                    724a81e5-447d-413d-a344-ac047f1babb8-image.png

                    I made this but I have the same error
                    QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")

                    02bc3100-29bc-4840-8a33-9db382857f7f-image.png
                    But this give my true

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #9

                    @AnthonyQt
                    But your very original post seemed to me at least to be saying you had it working with "F:\\data.sdf" but not with "Data Source=F:\\data.sdf;Persist Security Info=False;". Now it sounds like your issue has nothing to do with Persist Security Info=False;. I wish you would be clearer....

                    Anyway, I can only guess that Data source name not found error message means either the syntax is wrong or F:\data.sdf does not exist/is not accessible.

                    A 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @AnthonyQt
                      But your very original post seemed to me at least to be saying you had it working with "F:\\data.sdf" but not with "Data Source=F:\\data.sdf;Persist Security Info=False;". Now it sounds like your issue has nothing to do with Persist Security Info=False;. I wish you would be clearer....

                      Anyway, I can only guess that Data source name not found error message means either the syntax is wrong or F:\data.sdf does not exist/is not accessible.

                      A Offline
                      A Offline
                      AnthonyQt
                      wrote on last edited by AnthonyQt
                      #10

                      @JonB said in Error SQLCE database:

                      But your very original post seemed to me at least to be saying you had it working with "F:\data.sdf" but not with "Data Source=F:\data.sdf;Persist Security Info=False;". Now it sounds like your issue has nothing to do with Persist Security Info=False;. I wish you would be clearer....

                      No It never worked
                      I do this and move the database to D to see if the problem come from accessibility problem
                      10910266-e6f9-4eaf-b3a8-160bb23c203c-image.png
                      And I have this
                      4f177d2f-5bba-44d5-81ed-f4cf50793ea6-image.png
                      I don´t understand what is my error

                      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