Results 1 to 12 of 12

Thread: [RESOLVED] Why I can't connect to SQLITE db3 with Password?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    365

    Resolved [RESOLVED] Why I can't connect to SQLITE db3 with Password?

    It's successful to connect and operate myDB.db3, but If myDB.db3 has password protected, I can't connect. What is wrong?

    Code:
    SQLiteConnection sqliteConnection = new SQLiteConnection("Fail If Missing=True;Version=3;Password=totalise1234" + ";Data Source=" + @"C:\Users\acer\AppData\Roaming\Database\SQLite\myDB.db3");
     sqliteConnection.Open();

    myDB.db3 info:

    Database: main
    DataSource: C:\Users\acer\AppData\Roaming\Database\SQLite\myDB.db3
    Version: 3.35.5
    System.Data.SQLite Core: 1.0.114.0
    Encoding: UTF-8
    Journal Mode:
    Cache Size: 1048576
    Max Page Count: 1073741823
    Size: 180 KB (184,320 bytes)
    DataSource: C:\Users\acer\AppData\Roaming\Database\SQLite\myDB.db3
    Created: 9/22/2021 8:34:03 AM
    Modified: 9/22/2021 8:33:29 AM
    Accessed: 9/22/2021 8:34:07 AM
    Modules: dbstat, fts3, fts3tokenize, fts4, fts4aux, rtree, rtree_i32, sqlite_stmt
    Last edited by DaveDavis; Sep 21st, 2021 at 07:46 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,769

    Re: Why I can't connect to SQLITE db3 with Password?

    What EXACTLY happens if the database is password protected?

    By the way, you ought not to be hard-coding that full file path. You should be using Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) to get the first part of the folder path.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    365

    Re: Why I can't connect to SQLITE db3 with Password?

    Quote Originally Posted by jmcilhinney View Post
    What EXACTLY happens if the database is password protected?

    By the way, you ought not to be hard-coding that full file path. You should be using Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) to get the first part of the folder path.
    possible it is not the path issue, I think. With the same code, I removed the db3's Password and password string in connection string, then everything is back to OK.
    I see debug window reporting:
    Native library pre-loader is trying to load native SQLite library "F:\My Project\DBTest\bin\Debug\x86\SQLite.Interop.dll"...
    Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
    Could not load file or assembly 'System.Data.SQLite.SEE.License, Version=1.0.115.0, Culture=neutral, PublicKeyToken=433d9874d0bb98c5' or one of its dependencies. The system cannot find the file specified.
    Exception thrown: 'System.InvalidOperationException' in System.Data.SQLite.dll
    Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
    Exception thrown: 'System.IO.IOException' in mscorlib.dll
    Exception thrown: 'System.IO.IOException' in mscorlib.dll
    Exception thrown: 'System.ArgumentException' in System.Windows.Forms.dll

    I install the SQLLite through nuget, I don't know why it works for non-password, but fails with passworded protected db3.
    Last edited by DaveDavis; Sep 21st, 2021 at 10:20 PM.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,769

    Re: Why I can't connect to SQLITE db3 with Password?

    Quote Originally Posted by DaveDavis View Post
    possible it is not the path issue, I think.
    I wasn't suggesting that the path was related to your issue. You should never hard-code paths like that.
    Quote Originally Posted by DaveDavis View Post
    Native library pre-loader is trying to load native SQLite library "F:\My Project\DBTest\bin\Debug\x86\SQLite.Interop.dll"...
    Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
    Have you checked that location? Does that file exist? Check your references and see whether there is one that corresponds to that library that has Copy Local set to False rather than True. If there is, change and the DLL will then be copied to your output folder when you build.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    365

    Re: Why I can't connect to SQLITE db3 with Password?

    Look like it is license problem.

    Attached Images Attached Images  

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,769

    Re: Why I can't connect to SQLITE db3 with Password?

    I didn't see your edit to post #3 before I submitted post #4. It's amazing what you can discover when you look at all the relevant information.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    365

    Re: Why I can't connect to SQLITE db3 with Password?

    Quote Originally Posted by jmcilhinney View Post
    I didn't see your edit to post #3 before I submitted post #4. It's amazing what you can discover when you look at all the relevant information.
    No wonder failed ONLY with password protected db3 database.
    2000USD for license? I can't afford. What is workarounds to open an encrypted db3?

  8. #8
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,769

    Re: Why I can't connect to SQLITE db3 with Password?

    Multiple options, including SEE, are mentioned here:

    https://docs.microsoft.com/en-us/dot...bs=netcore-cli

    You might check the others and see whether they offer free/cheaper options.

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,769

    Re: Why I can't connect to SQLITE db3 with Password?

    Actually, I think that SEE is free to use anyway. I followed the SEE link from the page above and it says this:
    The cost of a perpetual source code license for SEE is US $2000.
    It seems like that license fee is only for the source code, not the use of the compiled software.

    EDIT:

    Scratch that. It seems like you cannot get SEE as anything but source code that you compile yourself. back to the other options to see if one is cheaper or free.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    365

    Re: Why I can't connect to SQLITE db3 with Password?

    Quote Originally Posted by jmcilhinney View Post
    Actually, I think that SEE is free to use anyway. I followed the SEE link from the page above and it says this:

    It seems like that license fee is only for the source code, not the use of the compiled software.

    EDIT:

    Scratch that. It seems like you cannot get SEE as anything but source code that you compile yourself. back to the other options to see if one is cheaper or free.
    It is a slightly good news...How to find the compiled System.Data.SQLite with SEE support on internet? Is a simple dll or pakage?

  11. #11
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,769

    Re: Why I can't connect to SQLITE db3 with Password?

    Quote Originally Posted by DaveDavis View Post
    It is a slightly good news...How to find the compiled System.Data.SQLite with SEE support on internet? Is a simple dll or pakage?
    That's not what I was suggesting. That would be illegal. You need a license to use it. I just thought that, as with many other software packages, you could get a license to use the compiled binaries for free or pay to get access to the source code. That is not the case. You have to get a license and there is only one license available, i.e. the one where you pay $2000 and they give you the source code. You could find a compiled DLL on the internet but you'd still need to pay for that license to use it legally.

    That page I linked to mentions three other options and provides links. I'm suggesting that you check them out and see if any of them offer cheaper or free licenses.

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    365

    Re: Why I can't connect to SQLITE db3 with Password?

    OK. I got right answer on stackoverflow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width