对不起这个问题,但我从来没有使用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