
- Python SQLite Tutorial
- Python SQLite - Home
- Python SQLite - Introduction
- Python SQLite - Establishing Connection
- Python SQLite - Create Table
- Python SQLite - Insert Data
- Python SQLite - Select Data
- Python SQLite - Where Clause
- Python SQLite - Order By
- Python SQLite - Update Table
- Python SQLite - Delete Data
- Python SQLite - Drop Table
- Python SQLite - Limit
- Python SQLite - Join
- Python SQLite - Cursor Object
- Python SQLite Useful Resources
- Python SQLite - Quick Guide
- Python SQLite - Useful Resources
- Python SQLite - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python SQLite - Establishing Connection
To establish connection with SQLite Open command prompt, browse through the location of where you have installed SQLite and just execute the command sqlite3 as shown below −

Establishing Connection Using Python
You can communicate with SQLite2 database using the SQLite3 python module. To do so, first of all you need to establish a connection (create a connection object).
To establish a connection with SQLite3 database using python you need to −
Import the sqlite3 module using the import statement.
The connect() method accepts the name of the database you need to connect with as a parameter and, returns a Connection object.
Example
import sqlite3 conn = sqlite3.connect('example.db')
Output
print("Connection established ..........")
Advertisements