Database Management System Laboratory TE Computer[2024-25]
----------------------------------------ASSIGNMENT NO. 8 ------------------------------------------
NAME:
ROLL NO:
Aim: Implement MYSQL/Oracle database connectivity with PHP/ python/Java Implement Database
navigation operations (add, delete, edit,) using ODBC/JDBC.
Description:
Two-Tier Architecture : The two-tier architecture is like client server application. The direct
communication takes place between client and server. There is no intermediate between client and
server. For example now we have a need to save the employee details in database.
The two tiers of two-tier architecture is:
1. Database (Data tier)
2. Client Application (Client tier)
Steps for connection with database :
1.Register driver with Driver Manager.
Class.forName(”com.mysql.jdbc.Driver”);
2.Create connection with database.
Connection conn=DriverManager.getConnection(url,username,password);
3.Submit statement to a database.
Statement start=conn.CreateStatement();
Result res=start.executeQuery(select * from Account);
4.Process the result.
while(res.next())
{ (System.out.println(res.getInt(”I }
D”));
5. Close the connection.
∗ Procedure :
1. Syntax for create :
create table <tablename>(in/out <variable name>type,in/out <variable
name> type...);
begin statement 1;
statement 2;
...
Statement
n end
Example :
create table Account(in id int,in ac type int,acc balance int);
end
Department of Computer Engineering, ICEM, Pune P a g e | 26
Database Management System Laboratory TE Computer[2024-25]
2. Syntax for insert :
insert into <tablename>values(value1,value2,value3...);
begin
statement 1;
statement 2;
...
Statement
n end
Example :
insert into Account values(1,’Saving’,1000); end
3. Syntax for update :
update <tablename>set column1=value1,column2=value2,... where some column=some
value; begin
statement 1;
statement 2;
...
statement
n end
Example :
update Account set ac balance=ac balance+amt where ac type=’saving’;
update Account set ac balance=ac balance-amt where ac type=’current’;
4. Syntax for delete :
delete from <tablename> where some column=some value;
begin
statement 1;
statement 2;
...
statement n; end
Example :
delete from Account where id=1;
delete from Account where acc type=’current’;
5. Syntax for select :
select column name,column name from <tablename> where id=value;
AND select * from <tablename>; begin
statement 1;
statement 2;
...
statement n end
Example :
select Account.id,Account.acc type from Account where
id=1; select * from Account;
Conclusion: Thus the JAVA Database connectivity concepts implemented using JDBC-ODBC.
Department of Computer Engineering, ICEM, Pune P a g e | 27