Database and Object Oriented Programming Assignment: Java and Database
VerifiedAdded on  2023/06/08
|12
|1669
|63
Homework Assignment
AI Summary
This assignment solution focuses on Database and Object Oriented Programming, addressing key aspects of database design and implementation using Java. It begins by outlining the process of developing business rules for database development, including interviews, documentation analysis, and stakeholder meetings. The solution then delves into establishing database connections using the Xampp server and Tomcat Server, providing the necessary Java code for establishing database connections. The assignment demonstrates data retrieval through SQL queries, showcasing code examples and results for selecting employee data. Furthermore, the solution covers the implementation of SQL queries for adding, updating, and deleting entries in the database, with corresponding code snippets and output examples. Finally, the assignment concludes with a bibliography of relevant sources, providing a comprehensive resource for students studying database and object-oriented programming concepts. The solution provides a practical guide for students looking to understand the principles of database design and Java-based database interaction.

Running head: DATABASE AND OBJECT ORIENTED PROGRAMING
Database and Object Oriented Programing
Name of the Student:
Name of the University:
Author Note
Database and Object Oriented Programing
Name of the Student:
Name of the University:
Author Note
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

1
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 1
For the development of any type of database for any type of website for the organizations
it is important that the business rules and the organizational requirements are predefined. This
would help the database developer in developing the required database so that all the required
data and information can be easily updated and fetched from the database and all the required
functions can be performed by the website developed for the organization very easily. There are
various type of processes that can be adopted by the developer for the development of the
business rules that are to be incorporated into the database for the organization.
Firstly, the developer would be conducted interviews about the business requirements for
the website that is to be developed. The stakeholders of the organization for whom the website is
to be developed would be able to gain knowledge about how the information within the
organization passes and they would also be able to gain knowledge on the parts where specific
pieces of data are relied upon and type of decisions that the organization depend for their
business procedures.
Additionally, there are the processes of business documentations and business forms. The
documentations and the business forms are distributed among the different type of staffs and the
stakeholders within the organization this, allows to them to provide their feedback and insights
about the type of data which are required by the business of the organization. In addition to this,
the business procedures and the data which are produced as a result of the procedures of the
organizations are also required to be stored in the database system which is developed for the
organization.
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 1
For the development of any type of database for any type of website for the organizations
it is important that the business rules and the organizational requirements are predefined. This
would help the database developer in developing the required database so that all the required
data and information can be easily updated and fetched from the database and all the required
functions can be performed by the website developed for the organization very easily. There are
various type of processes that can be adopted by the developer for the development of the
business rules that are to be incorporated into the database for the organization.
Firstly, the developer would be conducted interviews about the business requirements for
the website that is to be developed. The stakeholders of the organization for whom the website is
to be developed would be able to gain knowledge about how the information within the
organization passes and they would also be able to gain knowledge on the parts where specific
pieces of data are relied upon and type of decisions that the organization depend for their
business procedures.
Additionally, there are the processes of business documentations and business forms. The
documentations and the business forms are distributed among the different type of staffs and the
stakeholders within the organization this, allows to them to provide their feedback and insights
about the type of data which are required by the business of the organization. In addition to this,
the business procedures and the data which are produced as a result of the procedures of the
organizations are also required to be stored in the database system which is developed for the
organization.

2
DATABASE AND OBJECT ORIENTED PROGRAMING
Thirdly, a very important aspect of the database development for the organization is
working with the users and the management and this process involves the scheduling of meetings
with the representative and the management of the organization for grasping their inputs on the
development of the database for the website of the organization. This also enables the developer
to databases to define the rule and requirements of the organization and the business so that there
is no ambiguity or constrain in the business rules for the organization. In addition to this, some
constrains are established in the database so that no data type which is chosen for the database
are not stored and the developer or the admin doesn’t face any error during fetching the data for
their use.
In addition to this, the development of the database for the organization also involves
defining and establishing the business rules that are field specific. A number methods are to
performed before the establishment of these rules are done and these are selecting table at first,
review of each of the field and determining whether necessary rule of the fields is enough and
the rules for which the appropriate data storage is not done are modified. In addition to this, the
business rules are recorded on the specific sheets for the organizations.
Finally, after the developer performs all the required steps logical models are created by
the trial error method and finally after the logical designs are finalized the database creation is
done and it is implemented in servers. After the implementation, the integration of the database
with the backend procedures and the interface of the website is done. It is also check that all the
functionalities of the database are performed or not and the implementation of the website is
finalized.
Answer to question number 2
DATABASE AND OBJECT ORIENTED PROGRAMING
Thirdly, a very important aspect of the database development for the organization is
working with the users and the management and this process involves the scheduling of meetings
with the representative and the management of the organization for grasping their inputs on the
development of the database for the website of the organization. This also enables the developer
to databases to define the rule and requirements of the organization and the business so that there
is no ambiguity or constrain in the business rules for the organization. In addition to this, some
constrains are established in the database so that no data type which is chosen for the database
are not stored and the developer or the admin doesn’t face any error during fetching the data for
their use.
In addition to this, the development of the database for the organization also involves
defining and establishing the business rules that are field specific. A number methods are to
performed before the establishment of these rules are done and these are selecting table at first,
review of each of the field and determining whether necessary rule of the fields is enough and
the rules for which the appropriate data storage is not done are modified. In addition to this, the
business rules are recorded on the specific sheets for the organizations.
Finally, after the developer performs all the required steps logical models are created by
the trial error method and finally after the logical designs are finalized the database creation is
done and it is implemented in servers. After the implementation, the integration of the database
with the backend procedures and the interface of the website is done. It is also check that all the
functionalities of the database are performed or not and the implementation of the website is
finalized.
Answer to question number 2
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

3
DATABASE AND OBJECT ORIENTED PROGRAMING
For the establishment of the connection at first a server is to be established. The database
has been created on the Xampp server and the integration of the backend of the java server has
been created using the Tomcat Server. The code provided below has been used in the server
design:
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/usermaster", "root", "");
The coding above has been used for the connection to the xampp server. The output of
the program has been provided below:
DATABASE AND OBJECT ORIENTED PROGRAMING
For the establishment of the connection at first a server is to be established. The database
has been created on the Xampp server and the integration of the backend of the java server has
been created using the Tomcat Server. The code provided below has been used in the server
design:
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/usermaster", "root", "");
The coding above has been used for the connection to the xampp server. The output of
the program has been provided below:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

4
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 3
Part a
After the connection to the database has been made the data is retrieved from the
database and the following sql query is run using java:
Statement stmt1=con.createStatement();
ResultSet rs1=stmt1.executeQuery("select Emp_code, Emp_Name from Employee");
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 3
Part a
After the connection to the database has been made the data is retrieved from the
database and the following sql query is run using java:
Statement stmt1=con.createStatement();
ResultSet rs1=stmt1.executeQuery("select Emp_code, Emp_Name from Employee");

5
DATABASE AND OBJECT ORIENTED PROGRAMING
while(rs1.next())
System.out.println(rs1.getString(1)+" "+rs1.getString(2));
The code written above provides the results as per storage in the database in the Xampp
server.
Part b
Additionally, the sql queries has been also used in the Command prompt window to
provide the following results:
DATABASE AND OBJECT ORIENTED PROGRAMING
while(rs1.next())
System.out.println(rs1.getString(1)+" "+rs1.getString(2));
The code written above provides the results as per storage in the database in the Xampp
server.
Part b
Additionally, the sql queries has been also used in the Command prompt window to
provide the following results:
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

6
DATABASE AND OBJECT ORIENTED PROGRAMING
Part c
The result of only the Emp_code and the Emp_name has been provided below:
DATABASE AND OBJECT ORIENTED PROGRAMING
Part c
The result of only the Emp_code and the Emp_name has been provided below:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

7
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 4
Part a
The coding for the entering a new entry in the database has been provided below:
Statement stmt=con.createStatement();
System.out.println("Enter employee code:");
Scanner sc1 = new Scanner(System.in);
String eid = sc1.next();
System.out.println("Enter employee name:");
Scanner sc2 = new Scanner(System.in);
String ename = sc2.next();
System.out.println("Enter salary:");
Scanner sc3 = new Scanner(System.in);
String salary = sc3.next();
System.out.println("Enter Contact:");
Scanner sc4 = new Scanner(System.in);
String contact = sc4.next();
String q1 = "insert into employee values('" +eid+ "', '" +ename+
"', '" +salary+ "', '" +contact+ "')";
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 4
Part a
The coding for the entering a new entry in the database has been provided below:
Statement stmt=con.createStatement();
System.out.println("Enter employee code:");
Scanner sc1 = new Scanner(System.in);
String eid = sc1.next();
System.out.println("Enter employee name:");
Scanner sc2 = new Scanner(System.in);
String ename = sc2.next();
System.out.println("Enter salary:");
Scanner sc3 = new Scanner(System.in);
String salary = sc3.next();
System.out.println("Enter Contact:");
Scanner sc4 = new Scanner(System.in);
String contact = sc4.next();
String q1 = "insert into employee values('" +eid+ "', '" +ename+
"', '" +salary+ "', '" +contact+ "')";

8
DATABASE AND OBJECT ORIENTED PROGRAMING
The output for the following is provided below:
Part b
The code for updating the database has been provided below:
Statement stmt4=con.createStatement();
System.out.println("Enter Employee code:");
Scanner sc7 = new Scanner(System.in);
String eid1=sc7.next();
System.out.println("Enter Employee name:");
Scanner sc5 = new Scanner(System.in);
String ename1=sc5.next();
System.out.println("Enter Salary : ");
Scanner sc6 = new Scanner(System.in);
String salary1 =sc6.next();
String query = "update employee set Emp_name = '" +ename1+"' , Salary
= '" +salary1+ "' where Emp_Code = '" +eid1+ "'";
The output of the following code has been provided below:
DATABASE AND OBJECT ORIENTED PROGRAMING
The output for the following is provided below:
Part b
The code for updating the database has been provided below:
Statement stmt4=con.createStatement();
System.out.println("Enter Employee code:");
Scanner sc7 = new Scanner(System.in);
String eid1=sc7.next();
System.out.println("Enter Employee name:");
Scanner sc5 = new Scanner(System.in);
String ename1=sc5.next();
System.out.println("Enter Salary : ");
Scanner sc6 = new Scanner(System.in);
String salary1 =sc6.next();
String query = "update employee set Emp_name = '" +ename1+"' , Salary
= '" +salary1+ "' where Emp_Code = '" +eid1+ "'";
The output of the following code has been provided below:
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

9
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 5
Part a
The code for deletion of the data from the database is provided below:
Statement stmt=con.createStatement();
System.out.println("Enter employee code:");
Scanner sc1 = new Scanner(System.in);
String eid = sc1.next();
String q1 = "delete from Employee where Emp_Code ='"+eid +"'";
The following output is provided by the program:
Part b
The following catch fuctions is provided below:
DATABASE AND OBJECT ORIENTED PROGRAMING
Answer to question number 5
Part a
The code for deletion of the data from the database is provided below:
Statement stmt=con.createStatement();
System.out.println("Enter employee code:");
Scanner sc1 = new Scanner(System.in);
String eid = sc1.next();
String q1 = "delete from Employee where Emp_Code ='"+eid +"'";
The following output is provided by the program:
Part b
The following catch fuctions is provided below:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

10
DATABASE AND OBJECT ORIENTED PROGRAMING
catch(Exception e){ System.out.println(e)
e.printStackTrace;}
DATABASE AND OBJECT ORIENTED PROGRAMING
catch(Exception e){ System.out.println(e)
e.printStackTrace;}

11
DATABASE AND OBJECT ORIENTED PROGRAMING
Bibliography
Decan, A., Goeminne, M., & Mens, T. (2017). On the interaction of relational database access
technologies in open source java projects. arXiv preprint arXiv:1701.00416.
Dumoulin, C., Franciscus, G., & Husted, T. (2017). Struts in Action Building web applications
with the leading Java framework. Manning Publications Co..
Fournier-Viger, P., Gomariz, A., Gueniche, T., Soltani, A., Wu, C. W., & Tseng, V. S. (2014).
SPMF: a Java open-source pattern mining library. The Journal of Machine Learning
Research, 15(1), 3389-3393.
Fournier-Viger, P., Gomariz, A., Gueniche, T., Soltani, A., Wu, C. W., & Tseng, V. S. (2014).
SPMF: a Java open-source pattern mining library. The Journal of Machine Learning
Research, 15(1), 3389-3393.
Goeminne, M., & Mens, T. (2015, September). Towards a survival analysis of database
framework usage in Java projects. In Software Maintenance and Evolution (ICSME),
2015 IEEE International Conference on (pp. 551-555). IEEE.
Goyal, S. (2016). Database Connectivity in JAVA. International Journal of Engineering Science,
8615.
Just, R., Jalali, D., & Ernst, M. D. (2014, July). Defects4J: A database of existing faults to enable
controlled testing studies for Java programs. In Proceedings of the 2014 International
Symposium on Software Testing and Analysis (pp. 437-440). ACM.
Pater, P., & Moss, K. (2018). Java database programming with JDBC. Coriolis.
DATABASE AND OBJECT ORIENTED PROGRAMING
Bibliography
Decan, A., Goeminne, M., & Mens, T. (2017). On the interaction of relational database access
technologies in open source java projects. arXiv preprint arXiv:1701.00416.
Dumoulin, C., Franciscus, G., & Husted, T. (2017). Struts in Action Building web applications
with the leading Java framework. Manning Publications Co..
Fournier-Viger, P., Gomariz, A., Gueniche, T., Soltani, A., Wu, C. W., & Tseng, V. S. (2014).
SPMF: a Java open-source pattern mining library. The Journal of Machine Learning
Research, 15(1), 3389-3393.
Fournier-Viger, P., Gomariz, A., Gueniche, T., Soltani, A., Wu, C. W., & Tseng, V. S. (2014).
SPMF: a Java open-source pattern mining library. The Journal of Machine Learning
Research, 15(1), 3389-3393.
Goeminne, M., & Mens, T. (2015, September). Towards a survival analysis of database
framework usage in Java projects. In Software Maintenance and Evolution (ICSME),
2015 IEEE International Conference on (pp. 551-555). IEEE.
Goyal, S. (2016). Database Connectivity in JAVA. International Journal of Engineering Science,
8615.
Just, R., Jalali, D., & Ernst, M. D. (2014, July). Defects4J: A database of existing faults to enable
controlled testing studies for Java programs. In Proceedings of the 2014 International
Symposium on Software Testing and Analysis (pp. 437-440). ACM.
Pater, P., & Moss, K. (2018). Java database programming with JDBC. Coriolis.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 12
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2026 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.





