Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot Create Simple SQLite 1

Status
Not open for further replies.

sen5241b

IS-IT--Management
Sep 27, 2007
199
US
I want to do something which sounds very very simple but which has turned out to be incredibly difficult. I want to create a sqlite database with two one field tables of unicode text. I load the data from two text files. One is simply a list of surnames and the other a list of unicode place names. I load this same data into a Mysql database using my VM Ubuntu LAMP with no problems.

There is some bizarre problem that you cannot load data from text files into a MySQL or sqlite database on my website provider, GoDaddy. Can't load data from text files into a database --how pathetic! Support said you are on your own.

I tried Razorsql, SQLite Database Browser 2.0 and the Firefox plugin SQL Lite Manager and all failed to load the data because they can't process unicode or they create a corrupt database (razorsql).

My Ubuntu LAMP has PDO installed (as per phpinfo) but not sqlite, so I installed "libsqlite3-0" and "sqlite" with apt-get but still get errors when using PDO commands. This server says sqlite_open is an unknown function. The statement "$db = new PDO($db);" gives the error "Fatal error: Uncaught exception 'PDOException' with message 'invalid data source name' in etc, etc.

What is the simplest way to load two single columns of unicode text into two tables of a sqlite v3 database?


 
I created a database with "SQLite Manager" and I can query the two tables with that tool but this line:

$handle = sqlite_open($db) or die("Could not open database");

causes this error:

Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a database in /full spec of db on server/

 
After struggling with sqlite database versions, GoDaddy, management tools and functions meant for version 2 (sqlite_open) versus functions meant for version 3 (PDO) --I got this working. I created and loaded the DB with the Firefox plugin SQLite Manager then just used PDO statements.

I'm not sure why but the Firefox plugin SQLite Manager loaded my 296,281 row table in less than a minute or two as opposed to the other tools I mentioned above -they took hours!
 
Hi

sen5241b said:
I'm not sure why but the Firefox plugin SQLite Manager loaded my 296,281 row table in less than a minute or two as opposed to the other tools I mentioned above -they took hours!
One possible difference : RazorSQL is a generic tool and not knows each databases' all proprietary commands, so probably it loaded the data with separate [tt]insert[/tt] statements. SQLite Manager is an SQLite-only tool and knows a lot of SQLite specific tricks, so probably loaded the data with the proprietary [tt].import[/tt] command.

( Not properly verified this, but my measurements confirmed it for now. )


Feherke.
 
There was mention in the doc of FF plugin SQLite Manager about it doing some sort of bulk load.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top