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

Error SQLCE database

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 793 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 29 Apr 2021, 15:24 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

    J 1 Reply Last reply 29 Apr 2021, 17:14
    0
    • A AnthonyQt
      29 Apr 2021, 15:24

      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

      J Online
      J Online
      JonB
      wrote on 29 Apr 2021, 17:14 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 30 Apr 2021, 09:09 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")

        J J 2 Replies Last reply 30 Apr 2021, 09:13
        0
        • A AnthonyQt
          30 Apr 2021, 09:09

          @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")

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 30 Apr 2021, 09:13 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
            30 Apr 2021, 09:09

            @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")

            J Online
            J Online
            JonB
            wrote on 30 Apr 2021, 09:13 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 30 Apr 2021, 09:20
            1
            • J JonB
              30 Apr 2021, 09:13

              @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 30 Apr 2021, 09:20 last edited by
              #6

              @JonB

              I have \\

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

              But same error

              J 1 Reply Last reply 30 Apr 2021, 09:22
              0
              • A AnthonyQt
                30 Apr 2021, 09:20

                @JonB

                I have \\

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

                But same error

                J Online
                J Online
                JonB
                wrote on 30 Apr 2021, 09:22 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 30 Apr 2021, 09:43 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

                  J 1 Reply Last reply 30 Apr 2021, 09:58
                  0
                  • A AnthonyQt
                    30 Apr 2021, 09:43

                    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

                    J Online
                    J Online
                    JonB
                    wrote on 30 Apr 2021, 09:58 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 30 Apr 2021, 16:53
                    0
                    • J JonB
                      30 Apr 2021, 09:58

                      @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 30 Apr 2021, 16:53 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

                      9/10

                      30 Apr 2021, 09:58

                      • Login

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