Sunday, June 10, 2018

Customer Listing System Using Java JDBC and Oracle Database

In this article I would like to share with you guys a program that I wrote using Java JDBC and Oracle 11g Express Edition to display the customer records from the Oracle Database. This will be my first time to use Oracle as my database to store records of the customer. I find it very challenging at first but it is very worth while in learning new database like Oracle. I hope you find it useful my sample program.  

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.







Sample Program Output

Program Listing

Oraclecon.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


package oraclecon;


import java.sql.*;  
import java.sql.DriverManager;
import java.sql.Connection;

/**
 *
 * @author Jake R. Pomperada
 * June 10, 2018
 * Sunday, Bacolod City, Negros Occidental
 */
public class OracleCon {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       try{  
//step1 load the driver class  
Class.forName("oracle.jdbc.driver.OracleDriver");  
  
//step2 create  the connection object  
Connection con=DriverManager.getConnection(  
"jdbc:oracle:thin:@localhost:1521:xe","system","hr");  
  
//step3 create the statement object  
Statement stmt=con.createStatement();  
  
//step4 execute query  

System.out.println("CUSTOMER LISTING SYSTEM USING JAVA JDBC AND ORACLE DATABASE");
System.out.println();
System.out.println("Created By Mr. Jake R. Pomperada,MAED-IT");
System.out.println();

ResultSet rs=stmt.executeQuery("SELECT * FROM HR.CUSTOMERS ORDER BY ID ASC ");  
while(rs.next())  {
System.out.println("ID       :    "  +  rs.getInt(1));
System.out.println("Name     :    "  +  rs.getString(2));
System.out.println("Age      :    "  +  rs.getString(3));
System.out.println("Address  :    "  +  rs.getString(4));  
System.out.println(); 

  
}
System.out.println();
System.out.println("===== End of Program =====");
System.out.println(); 
//step5 close the connection object 
con.close();
}catch(Exception e){ System.out.println(e);}  
  
    }
    
}




No comments:

Post a Comment