English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

Which method is used to connect a database? Give an example. - Computer Science

Advertisements
Advertisements

Question

Which method is used to connect a database? Give an example.

Short Note

Solution

  • Connect()method is used to connect a database
  • Connecting to a database means passing the name of the database to be accessed.
  • If the database already exists the connection will open the same. Otherwise, Python will open a new database file with the specified name.

Example:
import sqlite3
# connecting to the database
connection = sqlite3.connect (“Academy.db”)
# cursor
cursor = connection. cursor()

shaalaa.com
Database
  Is there an error in this question or solution?
Chapter 15: Data manipulation through SQL - Evaluation [Page 318]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 15 Data manipulation through SQL
Evaluation | Q 2. | Page 318
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×