Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-26-2010, 09:00 AM   #1
LQ Newbie
Registered: Jun 2010
Posts: 1

Rep: Reputation: 0
SQLITE - Include multiple sql files in 1 transaction


I have a number of sql files containing creates, updates, selects and deletes. I need a shell script that will create a transaction around all these files to ensure that all statements are successfull otherwise I want to rollback.

i.e. if the machine crashes during the update I want to be left in a known state.

I have attempted this below but I get an error: 'unable to open database file'.

sqlite3 mydatabase.db <<ENDOFTEXT

.read populate1.sql
.read populate2.sql
.read populate3.sql


Any help would be really appreciated.

Old 06-27-2010, 04:31 AM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911
Hi Peter, welcome to LQ!

I don't actually use sqlite myself, but the obvious first
question to me is:

Are you in the directory where mydatabase.db is when
you execute that?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: New Benchmark Comparison of ITTIA DB SQL and SQLite LXer Syndicated Linux News 0 03-30-2010 06:00 PM
LXer: New Benchmark Comparison of ITTIA DB SQL and SQLite LXer Syndicated Linux News 0 03-30-2010 08:00 AM
[python] sqlite: Can you combine two database files? BrianK Programming 6 09-11-2008 06:59 AM
How to use variables in SQL insert statement (SQLite) montylee Programming 2 06-13-2008 07:06 AM
C++ Inheritance with Multiple Files, #include crap Hard Help please byteframe Programming 10 12-08-2005 07:04 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration