in

System.Data.SQLite

An open-source, enhanced version of the SQLite database engine for Windows

Migration from SQLite to MySQL - How to export a SQLite database???

Last post 04-08-2008 6:04 AM by Nik. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-27-2007 5:34 PM

    • xelag
    • Top 500 Contributor
    • Joined on 10-28-2007
    • Posts 2

    Migration from SQLite to MySQL - How to export a SQLite database???

     Hi,

    I am developping a software in C# using System.Data.SQLite to communicate with a SQLite database.. Well, I want to export this SQLite database so as to be able to build it again later in a MySQL database.

    Is there a way to do that? Exporting a database to SQL code?

    Do you know libraries which could do that?

    Thank you very much,

    Xelag
     

    Filed under: , , ,
  • 10-28-2007 9:31 AM In reply to

    • Nate
    • Top 10 Contributor
    • Joined on 08-28-2005
    • Fort Collins, CO
    • Posts 67

    Re: Migration from SQLite to MySQL - How to export a SQLite database???

    These links should help you.

    http://support.microsoft.com/kb/555375 

    http://www.sqlite.org/sqlite.html

    http://www.google.com/search?q=sqlite+%22export+data%22 

    http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html 

    http://www.mail-archive.com/sqlite-users@sqlite.org/msg26954.html 

    Short answer, open the database using the command line product, .export.

  • 10-28-2007 3:24 PM In reply to

    • xelag
    • Top 500 Contributor
    • Joined on 10-28-2007
    • Posts 2

    Re: Migration from SQLite to MySQL - How to export a SQLite database???

     Ok thank you.

    I don't understand why you give me the first link? was my post so bad?

    So, I succeed in migrating MySql <----> SQLite 

    SQLite ----> MySql

    1. Download sqlite3.exe on http://www.sqlite.org
    2. Export the SQLite database with sqlite3.exe and command parameter ".dump" (Nate, ".export" doesn't exist!), an example :
      sqlite3 mySQLiteDataBase .dump .quit >> myDumpSQLite
    3. Adapt the dump to get it compatible for MySQL
        - Replace " (double-quotes) with ` (grave accent)
        - Remove "BEGIN TRANSACTION;" "COMMIT;", and lines related to "sqlite_sequence"
        - Replace "autoincrement" with "auto_increment"
    4. The dump is ready to get imported in a MySQL server

    MySql ----> SQLite

    1. Export the database in an ASCII compatible format. (functionnality available in phpMyAdmin 2.6.1)
    2. Import to SQLite with command line : sqlite3 mySQLiteDataBase < dumpMySQL

    What do you think Nate? Does this way seem correct to you?
     

     

    Filed under: , , ,
  • 10-28-2007 4:38 PM In reply to

    • Nate
    • Top 10 Contributor
    • Joined on 08-28-2005
    • Fort Collins, CO
    • Posts 67

    Re: Migration from SQLite to MySQL - How to export a SQLite database???

    Yes, as you pointed out, I was pointing to the .dump function, not "export". As for your process, without knowing the details of your situation (again, refer to link #1), I cannot comment on whether or not it is advisable. The way you document the process leads me to believe you intend to do this more than just one time.

    The reason I posted Link 1 was because of the "before asking" section. Your answer is easily found.

     Before asking
     
    - Search the archives/FAQ before you post. Most forums and newsgroups have some sort of online FAQ (FAQ stands for Frequently Asked Questions) or archives. You should always perform a search on these resources before asking your "very important and unique" question. Many questions have already been answered, there is no point in answering them again, and some communities have members who will flame you for not doing so before asking. Another good idea is to do a keyword search for words relating to your question on the archives before you post.
     
    - Use online search engines such as MSN Search, Google, Yahoo! or other search engines. Post the error message you're getting on your preferred search engine and see what you come up with. Let us know what you found, especially if your problem is identical or similar to your findings.
     
    - Look for an answer in the manual, documentation or readme file and tell us about it.

  • 04-08-2008 6:04 AM In reply to

    • Nik
    • Not Ranked
    • Joined on 04-08-2008
    • Posts 1

    Re: Migration from SQLite to MySQL - How to export a SQLite database???

     In addition you should replace the following too in case you have boolean columns with default values:

    • DEFAULT 't' -> DEFAULT '1' 
    • DEFAULT 'f' -> DEFAULT '0'
    Nik

     

    Filed under: , , ,
Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems