downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

PDO::sqliteCreateAggregate> <SQLite (PDO)
Last updated: Fri, 13 Nov 2009

view this page in

PDO_SQLITE DSN

(PECL PDO_SQLITE >= 0.2.0)

PDO_SQLITE DSNSQLite データベースに接続する

説明

PDO_SQLITE データソース名 (DSN) は以下の要素で構成されます:

DSN 接頭辞 (SQLite 3)

DSN 接頭辞は sqlite: です。

  • ディスク上のデータベースにアクセスするには、 DSN 接頭辞に絶対パスを付加してください。

  • メモリ内にデータベースを生成するには、 DSN 接頭辞に :memory: を付加してください。

DSN 接頭辞 (SQLite 2)

PHP 5.1 における SQLite 拡張モジュールは SQLite 2 データベースへのアクセスと生成機能を サポートする PDO ドライバを提供しています。 これにより、PHP の以前のバージョンにおける SQLite 拡張を用いて生成したデータベースにアクセスすることが可能です。

注意: SQLite 2 ドライバは PDO と ext/sqlite を有効にした場合、 PHP 5.1.x でのみ利用可能です。現時点では PECL 経由では利用できません。

SQLite 2 データベースに接続するための DSN 接頭辞は sqlite2: です。

  • ディスク上のデータベースにアクセスするには、 DSN 接頭辞に絶対パスを付加してください。

  • メモリ内にデータベースを生成するには、 DSN 接頭辞に memory: を付加してください。

例1 PDO_SQLITE DSN の例

以下の例は、SQLite データベースへの接続するための PDO_SQLITE DSN を表します:

sqlite:/opt/databases/mydb.sq3
sqlite::memory:
sqlite2:/opt/databases/mydb.sq2
sqlite2::memory:



PDO::sqliteCreateAggregate> <SQLite (PDO)
Last updated: Fri, 13 Nov 2009
 
add a note add a note User Contributed Notes
PDO_SQLITE DSN
FST777
21-Apr-2008 12:27
@ Fatmoon
That is correct. SQLite sometimes uses additional files in the same folder while writing to the DB. These files can sometimes be seen and usually contain the name of your DB and the word 'journal' in their filename.
Security wise, it might be a good idea to store the SQLite databases in a seperate folder to shield the rest from user www.
Fatmoon
21-Apr-2008 02:42
It seems that the directory that contains your sqlite database must be writeable by the web server. Making just the file writeable won't work.
rick
30-Oct-2006 06:51
Don't forget "extension=php_pdo_sqlite.dll" has to be enabled in php.ini (if you use xampp is will be disabled by default) .

PDO::sqliteCreateAggregate> <SQLite (PDO)
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites