Sqlite-Database

Java-Examples

                                                                                                                                                                                                                    Show all | Close all
  • Introduction

    • Sqlite

      SQLite (/??skju??l'la?t/[2] or /'si?kw?l.la?t/)[3] is a relational database management system contained in a small (~350 KiB)[4] C programming library. In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application, but an integral part of it. SQLite is ACID-compliant and implements most of the SQL standard, using a dynamically and weakly typed SQL syntax that does not guarantee the domain integrity. SQLite is a popular choice as embedded database for local/client storage in application software such as web browsers. It is arguably the most widely deployed database engine, as it is used today by several widespread browsers, operating systems, and embedded systems, among others.[5] SQLite has many bindings to programming languages.
      The source code for SQLite is in the public domain
    • Design

      Unlike client-server database management systems, the SQLite engine has no standalone processes with which the application program communicates. Instead, the SQLite library is linked in and thus becomes an integral part of the application program. (In this, SQLite follows the precedent of Informix SE of c. 1984) The library can also be called dynamically. The application program uses SQLite's functionality through simple function calls, which reduce latency in database access: function calls within a single process are more efficient than inter-process communication. SQLite stores the entire database (definitions, tables, indices, and the data itself) as a single cross-platform file on a host machine. It implements this simple design by locking the entire database file during writing. SQLite read operations can be multitasked, though writes can only be performed sequentially
    • Usage

      Java technology is a high-level programming and a platform independent language. Java is designed to work in the distributed environment on the Internet. Java has a GUI features that provides you better "look and feel" over the C++ language, moreover it is easier to use than C++ and works on the concept of object-oriented programming model. Java enable us to play online games, video, audio, chat with people around the world, Banking Application, view 3D image and Shopping Cart. Java find its extensive use in the intranet applications and other e-business solutions that are the grassroots of corporate computing. Java , regarded as the most well described and planned language to develop an applications for the Web. Java is a well known technology which allows you for software designed and written only once for an "virtual machine" to run on a different computers, supports various Operating System like Windows PCs, Macintoshes, and Unix computers. On the web aspect, Java is popular on web servers, used by many of the largest interactive websites. Java is used to create standalone applications which may run on a single computer or in distributed network. It is also be used to create a small application program based on applet, which is further used for Web page. Applets make easy and possible to interact with the Web page.
  • Histroy

    D. Richard Hipp designed SQLite in the spring of 2000 while working for General Dynamics on contract with the United States Navy.[7] Hipp was designing software used on board guided missile destroyers, which were originally based on HP-UX with an IBM Informix database back-end. The design goals of SQLite were to allow the program to be operated without installing a database management system or requiring a database administrator. In August 2000, version 1.0 of SQLite was released, based on gdbm (GNU Database Manager). SQLite 2.0 replaced gdbm with a custom B-tree implementation, adding support for transactions. SQLite 3.0, partially funded by America Online, added internationalization, manifest typing, and other major improvements. In 2011 Hipp announced his plans to add an UnQL interface to SQLite databases and to develop UnQLite, an embeddable document-oriented database
  • Features

    SQLite implements most of the SQL-92 standard for SQL but it lacks some features. For example it has partial support for triggers, and it can't write to views (however it supports INSTEAD OF triggers that provide this functionality). While it supports complex queries, it still has limited ALTER TABLE support, as it can't modify or delete columns.[9]
    SQLite uses an unusual type system for a SQL-compatible DBMS. Instead of assigning a type to a column as in most SQL database systems, types are assigned to individual values; in language terms it is dynamically typed. Moreover, it is weakly typed in some of the same ways that Perl is: one can insert a string into an integer column (although SQLite will try to convert the string to an integer first, if the column's preferred type is integer). This adds flexibility to columns, especially when bound to a dynamically typed scripting language. However, the technique is not portable to other SQL products. A common criticism is that SQLite's type system lacks the data integrity mechanism provided by statically typed columns in other products. The SQLite web site describes a "strict affinity" mode, but this feature has not yet been added.[10] However, it can be implemented with constraints like CHECK(typeof(x)='integer').[7]

    Several computer processes or threads may access the same database concurrently. Several read accesses can be satisfied in parallel. A write access can only be satisfied if no other accesses are currently being serviced. Otherwise, the write access fails with an error code (or can automatically be retried until a configurable timeout expires). This concurrent access situation would change when dealing with temporary tables. This restriction is relaxed in version 3.7 when WAL is turned on enabling concurrent reads and writes.[11] A standalone program called sqlite3 is provided that can be used to create a database, define tables within it, insert and change rows, run queries and manage a SQLite database file. This program is a single executable file on the host machine. It also serves as an example for writing applications that use the SQLite library.
    SQLite is a popular choice for local/client SQL storage within a web browser and within a rich internet application framework;[12] most notably the leaders in this area (Google Gears,[13] Adobe AIR,[14] and Firefox[15]) embed SQLite.
    SQLite full Unicode support is optional.[16]
    SQLite also has bindings for a large number of programming languages, including BASIC, C, C++, Clipper//Harbour, Common Lisp, C#, Curl, D, Delphi, Free Pascal, Haskell, Java, Livecode, Lua, newLisp, Objective-C (on OS X and iOS), OCaml, Perl,[17] PHP, Pike, Python,[18] REBOL, R, REALbasic, Ruby,[19] Scheme, Smalltalk, Tcl, Visual Basic, and JavaScript.[20] An ADO.NET adapter, initially developed by Robert Simpson, is maintained jointly with the SQLite developers since April 2010.[21] An ODBC driver has been developed and is maintained separately by Christian Werner.[22] Werner's ODBC driver is the recommend connection method for accessing SQLite from OpenOffice.[23] There is also a COM (ActiveX) wrapper making SQLite accessible on Windows to scripted languages such as JScript and VBScript. This adds database capabilities to HTML Applications (HTA).[24]
    SQLite has automated regression testing prior to each release.[25] Over 2 million tests are run as part of a release's verification. Starting with the August 10, 2009 release of SQLite 3.6.17, SQLite releases have 100% branch test coverage, one of the components of code coverage.
  • Operating systems

    Due to its small size, SQLite is well suited to embedded systems, and is also included in:
      Microsoft's Windows Phone 8
      Apple's iOS
      Symbian OS
      Nokia's Maemo
      Google's Android
      RIM's BlackBerry
      Linux Foundation's MeeGo
      HP's webOS
      NetBSD
      However, it is also suitable for desktop operating systems; Apple adopted it as an option in OS X's Core Data API from the original implementation in Mac OS X 10.4 onwards, and also for administration of videos and songs on the iPhone.
  • SQLite Manager


    SQLite Manager is a SQLite database manager provided as a Firefox extension. By providing the software as a Firefox extension, SQLite Manager is available on many different platforms and trivially easy to install. As well as being provided as a Firefox extension it's also available for a few other environments.

    It uses the SQLite library built into its hosting application (Firefox), and therefore supports versions of database files supported by Firefox's built-in library.
      It allows the user to:
      View the contents of one or more SQLite databases.
      Manage tables, indexes, views and triggers.
      View and manage the records.
      Build an SQL query and execute it.
      Export data to CSV or XML.
  • Install Sqlite

    In the following tutorial i show how i installed sqlite on my personal laptop running 32 bits windows 7 operating system. Then i use the dos prompt to create a default folder for sqlite database. Finally i test the interaction with the sqlite3 shell by showing the following 3 basic sqlite commands: .help, .quit and .exit.
    1- Go to http://www.sqlite.org and install the latest binary of sqlite for windows on your hard drive.
    In my case: I downloaded the zip file of the version 3.7.6.3 for the 32bit windows operating systems namely sqlite-shell-win32-x86-3070603.zip. This file consists of only an executable file sqlite3.exe
    2- Unzip the dowloaded package into your default execution folder otherwise you need to define the location of sqlite executable (sqlite3.exe) in the windows path environment variable.
    In my case: I extracted the zipped folder and put the sqlite3.exe file in C:\Windows\System32
    3- Run the command line prompt and create a folder for the sqlite databases:
    Click Start and type cmd on the Run prompt then execute the following dos commands.
    Execution sequence:
    C:\Users\yahawana>cd \
    
    C:\>md SqliteRepository
    
    C:\>cd SqliteRepository
    
    C:\SqliteRepository>dir
    This empty folder from now on will be hosting your sqlite database files. For more details about the most usefull DOS commands refer to our tutorial: MS DOS Basic And Most Used Commands – A Crash Course. You can also follow this link http://ss64.com/nt for an index of MS DOS commands or this resumed list http://www.sophos.com/support/knowledgebase/article/13195.html
    4- Run the sqlite binary
    Execution:
    C:\SqliteRepository>sqlite3
    Result:
    SQLite version 3.7.6.3
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite>
    Now you’re no more on the dos prompt but instead on sqlite command line. Hence you can execute sqlite statements to create databases, tables, views and insert, update, delete data etc.
    5- Type .help to browse the available sqlite commands
    sqlite>.help
    execute the .help command on the sqlite3 shell
    6-type .quit (or .exit) to return to dos comand line.
    sqlite>.quit (or .exit)
  • Download...

    Click here to download


    Click Here to download Sqlite