對不起這個問題,但我從來沒有使用SQLite的工作,和我通過SQLite的網站了,下載了「預編譯的二進制對於Windows」文件試圖使它們可用於我的目的,但我couldnot,我看到與數據庫,表的工作教程。如何導入SQLite的DB3文件
我的任務是從SQLite獲取數據並將它們放到magento mysql數據庫中。所以爲此,我將SQLite數據庫轉儲文件作爲.db3文件,具有db轉儲文件(20110125_SIZE)大小的txt文件。
那麼我怎樣才能將它導入到SQLite中。請如果任何人與SQLite3合作,幫助我瞭解.db3文件,我怎麼能看到他們的記錄。
我有sqlite3的數據庫轉儲作爲dbname.db3,
於是我想這sqllite從PHP連接。這是我從論壇獲得的示例代碼。
$db = openDatabase();
unset($db);
function openDatabase() {
$dbFile = realpath('dbname.db3');
echo $dbFile . "\n";
$needDbCreate = !file_exists($dbFile);
$db = new SQLiteDatabase($dbFile) or die((file_exists($dbFile)) ? "Unable to open" : "Unable to create");
if($needDbCreate) {
}
return $db;
}
但我越來越致命的例外。
Fatal error: Uncaught exception 'SQLiteException' with message 'SQLiteDatabase::_construct() [sqlitedatabase.--construct]: file is encrypted or is not a database' in C:\wamp\www\SQLITE\index.php:23 Stack trace: #0 C:\wamp\www\SQLITE\index.php(23): SQLiteDatabase->_construct('C:\wamp\www\SQL...') 1 C:\wamp\www\SQLITE\index.php(15): openDatabase() #2 {main} thrown in C:\wamp\www\SQLITE\index.php on line 23
但是,當我嘗試與PDO相同的sqldump,我已連接。
try {
$dbh = new PDO("sqlite:C:\wamp\www\SQLITE\dbname.db3");
echo 'Db Connected <br/>';
}
catch(PDOException $e)
{
echo $e->getMessage();
}
這裏我不知道這個轉儲中可用的表的列表,所以我如何查詢他們列表,然後從他們獲取記錄。
請幫我解決這個問題ti連接並從php瀏覽表格。
Sorry for posting here in answer section, i wanted to highlight the code.
感謝
編輯我的答覆覆蓋應該已被編輯成你原來的問題:) – 0xC0000022L 2011-03-03 02:02:43