0% found this document useful (0 votes)
4 views11 pages

Group 3

The document outlines the concept of databases, their importance in applications, and the process of accessing them through various programming languages. It details the steps for database access, including choosing a database, installing drivers, establishing a connection, executing queries, and handling results. Additionally, it highlights tools, libraries, applications, and advantages of using databases in software development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views11 pages

Group 3

The document outlines the concept of databases, their importance in applications, and the process of accessing them through various programming languages. It details the steps for database access, including choosing a database, installing drivers, establishing a connection, executing queries, and handling results. Additionally, it highlights tools, libraries, applications, and advantages of using databases in software development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Database Access from

Programming Languages
Introduction
• • What is a Database?
• - A structured collection of data stored electronically.
• • Importance of Databases in Applications:
• - Centralized data storage, retrieval, and
management.
• - Backbone of many software applications.
• • What is Database Access?
• - The process of connecting a programming language
to a database.
Programming Languages and Databases
• • Common Programming Languages:
• - Python, Java, C#, PHP, Ruby, etc.
• • Types of Databases:
• - Relational Databases (e.g., MySQL,
PostgreSQL, Oracle).
• - NoSQL Databases (e.g., MongoDB,
Cassandra).
Key components to consider
• Database management system
• Database library/drivers. Enables
communication between the program and
dbms
• Connecton parameters i.e Host,
Port,Username and database name
Steps for Database Access
1. Choose the database. Decide the type of
database i.e relational (SQL)e.g MySQL,
PostgreSQL and etc or non-relational like
MongoDB,firebase and etc
2. Install Database Drivers
Necessary to connect a programming language
with the database.
Steps for Database Access
3. Establish a Connection
Use the drivers /library to establish a connection
4.Execute Queries
SQL commands for data manipulation (SELECT, INSERT,
UPDATE, DELETE).
5. Handle Results
process and display retrieved data.
7.Close the Connection
8. Free up resources and ensure security.
Tools and Libraries
• • Python:
• - Libraries: SQLite, SQLAlchemy, psycopg2
(PostgreSQL), PyODBC (SQL Server).
• • Java:
• - Libraries: JDBC (Java Database
Connectivity).
• • C#:
• - Libraries: ADO.NET, Entity Framework.
Example Code Snippet
• Python Example (Connecting to SQLite):

• import sqlite3

• # Connect to database
• connection = sqlite3.connect('example.db')

• # Create a cursor
• cursor = connection.cursor()

• # Execute a query
• cursor.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)")

• # Commit and close


• connection.commit()
• connection.close()
Applications
• Web development , storing and retrieving user
data such as user credentials
• Mobile app, synchronizing data across device
• Data analysis, extracting and analyizing large
data set for insight
• Enterprise applications
Advantages
• Centralized data management
• Efficient data handling
• Data consistency. Ensure all users and
applications see consistent data through
transaction management and
ACID(Atomicity,Consistency,Isolation,Durabilit
y)
• Security and access control
Cont….
• Easy integration
• Multi-user access
• Reduce application complexity

You might also like