// import sql libraray
import java.sql.*;
class databaseConnection{
public static void main(String args[]){
try{
// register the drivers
Class.forName("com.mysql.jdbc.Driver");
// create the connection instance
// do fill the username and password,port number as of
your database
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:portNumber","username","password");
// create the statment to execute the query
// different types of sql statements are
avaiable
// callable,prepared,statment
Statement stmt=con.createStatement();
// resultset instance to hold the result of
query
ResultSet rs=stmt.executeQuery("select * from
emp");
// rs.next is pointer the rows of result
// we can move along each row by calling
rs.next()
while(rs.next())
// getString ,getInt(),getDouble() are differet method
to get the column value
// so you must aware of the datatype of column
otherwise exception is thrown
System.out.println(rs.getInt(1)+" "+rs.getString(2)+"
"+rs.getDouble(3));
// colse the connection
con.close();
}
catch(Exception e){
// any wxception inside the class
ishandled here
System.out.println(e);
}
}
}
10. a. Write a short Java Program that shows how SQL commands and JDBC can be...
Write the java program: A right triangle can have sides whose lengths are all integers. The set of three integer values for the length of the sides of a triangle is called a Pythagorean triple. The length of the three sides must satisfy the relationship that the sum of the squares of the sides is equal to the square of the hypotenuse. Write a Java application that prompts the user for an integer that represents the largest side value and...
Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...
How can we assess whether a project is a success or a
failure?
This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...
What an Executive Summary Is
An executive summary is a specific type of document that does
two things: it summarizes a research article, and it offers
recommendations as to how information from the article can be
used.
Some long reports can contain an executive summary section, as
indicated in the Pearson handbook.
Write a 2 pahe Executive Summary
In business contexts, an executive summary is always written
for a specific purpose: to explain the information in the article
to a...