Access Gallery Database Using a High-Level Language Acceptable Languages: C or any version (C++,C#, etc.) PHP XML Java Python Write an application that allows a user to: Print records from the DB Access any record based on attribute values Sort a report Program may use either dynamic or static sql, but static is preferred. Submit your program source and object code and a printout of it in
Please read given instructions in code carefully
package com.example.poc;
import java.sql.*;
public class SampleDb {
public SampleDb() {
// TODO Auto-generated constructor stub
}
// Assuming you have mysql installed on your system
// Create database name it gallery
// Create table gallery_table having attributes id and value both are integer
// (change as per your convenience make code change also);
public static void main(String args[]) {
try (Connection connection = createConnection();) {
SampleDb sampleDb = new SampleDb();
sampleDb.diplayAllRecords(connection);
// change input id value as per your requirement
Integer id = 2;
sampleDb.displaySpecificRecord(connection, id);
} catch (Exception e) {
System.out.println(e);
}
}
private void displaySpecificRecord(Connection connection, Integer id) throws SQLException {
Statement stmt = connection.createStatement();
// gallery table is sql tablename
ResultSet rs = stmt.executeQuery("select * from gallery_table where id=" + id + ";");
if (rs.isBeforeFirst()) {
while (rs.next()) {
System.out.println(rs.getInt("id") + " " + rs.getInt("value"));
}
} else {
System.out.println("Record not found for provide attribute");
}
}
private void diplayAllRecords(Connection connection) throws SQLException {
Statement stmt = connection.createStatement();
// gallery table is sql tablename
ResultSet rs = stmt.executeQuery("select * from gallery_table;");
if (rs.isBeforeFirst()) {
while (rs.next()) {
System.out.println(rs.getInt("id") + " " + rs.getInt("value"));
}
} else {
System.out.println("Nothing to print");
}
}
private static Connection createConnection() {
// Running on java 8
// for class not found exception put mysql-connector-java-5.0.8-bin.jar as
// external library
try {
Class.forName("com.mysql.jdbc.Driver");
// TODO put your database name instead of gallery and user-name password
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/gallery", "root", "root");
return con;
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
Access Gallery Database Using a High-Level Language Acceptable Languages: C or any version (C++,C#, etc.) PHP...
Project Description In this project, you will design and implement a database for keeping track of information for an online “SOCIAL NETWORK” system (e.g. a simplified version of Facebook!). You will first design an EER schema diagram for this database application. Then, you will map the EER schema into a relational database schema and implement it on ORACLE or MySQL or some other relational DBMS. Finally, you will load some data into your database (via user Interface) and create some...
Read this article. Then write a 250 word response on two of the programs you like the most. Open source business intelligence software 1. BIRT BIRT is an open source BI program that CloudTweaks says is often viewed as the industry standard. BIRT boasts “over 12 million downloads and over 2.5 million developers across 157 countries.” Its users include heavyweights such as Cisco, S1, and IBM (which is also a BIRT sponsor). They also have maturity going for them, as...