In the last blog we gave the overview on Sqlite compilation Procedure, so this time we thought to elaborate an hidden topic that is Sqlite DSN. The Data Source Name is a data structure comprising information on data source (Sqlite database) in order to provide ODBC (Open Database Connectivity) driver all the needed information to establish a connection to the data source. Its structure is analogous to URL address and comprises;
Sqlite is supported by almost all the ORMs due to its light-weighted embedded structure which only needs you to specify the path to the file comprising the whole database. Although Sqlite provide all the modern security mechanisms, you can connect to the database and access or edit it without any credentials like user-name or password.
PDO_SQLITE DSN
Sqlite DSN PDO is a PHP extension to check PHP’s database connections by creating uniform interface allowing developers to create codes which are portable with all the platforms and databases. Amongst these databases comes; IBM DB2, MYSQL, ODBC, PGSQL, and also Sqlite.
PDO_SQLITE DSN — Connecting to Sqlite databases
Description:
The PDO_SQLITE DSN (Data Source Name) comprises following elements:
Sqlite DSN prefix (Sqlite 3)
DSN prefix is sqlite:
DSN prefix (Sqlite 2)
The Sqlite extension in PHP 5.1 provides a PDO driver which supports creation and access of Sqlite 2 databases. You will be able to access databases which you have created with Sqlite extension in PHP previous versions.
The DSN prefix for connecting to Sqlite 2 databases is sqlite2:
Examples:
PDO_Sqlite DSN Example for connecting to Sqlite databases:
sqlite:/opt/databases/mydb.sq3
sqlite::memory:
sqlite2:/opt/databases/mydb.sq2
sqlite2::memory:
How to Create User DSN to export the Sqlite Database
Conclusion: – The above discussed section gave a brief about Sqlite DSN and how to create DSN for exporting the database when using a software for Sqlite Corruption Recovery, which will allow you to save your recovered Database in .mdf, .mdb and .sqlite using DSN registry.