Database Articles

  Home arrow Database Articles arrow Page 3 - PEAR::SQLite: The Lightweight Alternat...
DATABASE ARTICLES

PEAR::SQLite: The Lightweight Alternative
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-02-22

    Table of Contents:
  • PEAR::SQLite: The Lightweight Alternative
  • Installing PEAR::SQLite
  • Connecting to a Database
  • Queries
  • Composite Code
  • Unsupported SQL Commands

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    PEAR::SQLite: The Lightweight Alternative - Connecting to a Database


    (Page 3 of 6 )

    Connection to an SQLite database is a bit different if you've only worked with MySQL. MySQL is designed for a multi-user environment whereas SQLite was designed to be embedded in standalone applications. Consequently, you won't need a user ID and password to connect.

    Instead you'll use an array to form a data source name (DSN). A DSN is essentially a pointer used to locate the database files.

    The first key of the array is "database" and accepts the location of a file that will act as your database's information store. If the file doesn't exist, SQLite will attempt to create it and assign it the access permissions set by the next key, "mode".

    The DSN is then passed to the connect method and a connection is established.

    <?php
    $DSN 
    = array(
           
    "database" =&gtgetcwd() . "/dbase/mydbase.db",
           
    "mode"     =&gt0644);
    $db->connect($DSN);
    ?>

    The disconnect method is used to disconnect from the database.

    <?php
    $db
    ->disconnect();
    ?>

    More Database Articles Articles
    More By bluephoenix

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap