1import sqlite3
2
3try:
4 sqliteConnection = sqlite3.connect('SQLite_Python.db')
5 cursor = sqliteConnection.cursor()
6 print("Database created and Successfully Connected to SQLite")
7
8 sqlite_select_Query = "select sqlite_version();"
9 cursor.execute(sqlite_select_Query)
10 record = cursor.fetchall()
11 print("SQLite Database Version is: ", record)
12 cursor.close()
13
14except sqlite3.Error as error:
15 print("Error while connecting to sqlite", error)
16finally:
17 if (sqliteConnection):
18 sqliteConnection.close()
19 print("The SQLite connection is closed")