Open shashankpathak opened 7 years ago
package com.cg.demotwo.ui;
import java.io.FileInputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Properties; import java.util.Scanner;
public class MyTest { public static void main(String[] args) { Scanner scr = new Scanner(System.in); System.out.println("enter product id "); int id = scr.nextInt(); System.out.println("Enter product name"); String pName = scr.next(); System.out.println("Enter product price"); double price = scr.nextDouble(); System.out.println("Enter descripton"); String des = scr.next();
try
{
FileInputStream fileRead = new FileInputStream("oracle.properties");
Properties pros = new Properties();
pros.load(fileRead); //load properties file
String driver = pros.getProperty("oracle.driver");
String url = pros.getProperty("oracle.url");
String uname = pros.getProperty("oracle.username");
String upass = pros.getProperty("oracle.password");
//Load driver
Class.forName(driver);
//Making connection
Connection conn = DriverManager.getConnection(url, uname, upass);
System.out.println("Connection established...");
System.out.println("Enter the choice");
String query = "INSERT INTO PRODUCTDB VALUES(?,?,?,?)";
PreparedStatement pstm = conn.prepareStatement(query);
pstm.setInt(1,id);
pstm.setString(2,pName);
pstm.setDouble(3,price);
pstm.setString(4,des);
int status = pstm.executeUpdate();
System.out.println(status);
}
catch (IOException | ClassNotFoundException | SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("No connection...");
}
}
}
package com.cg.ems.ui;
import java.util.List; import java.util.Scanner;
import com.cg.pms.dto.Product; import com.cg.pms.exception.ProductException; import com.cg.pms.service.IProductService; import com.cg.pms.service.ProductServiceImpl;
public class MyTest { public static void main(String[] args) { int choice = 0 ; //Run Time Polymorphism IProductService prodService = new ProductServiceImpl();
do {
printDetails();
Scanner scr = new Scanner(System.in);
System.out.println("Enter the choice..");
choice = scr.nextInt();
switch(choice){
case 1: //add
int msg =0;
// System.out.println("Enter the ProductId"); // int prodId = scr.nextInt(); String patt = "[A-Z][a-z]{2,19}"; System.out.println("Enter the ProductName"); String prodName = scr.next(); try { ProductServiceImpl.validateName(prodName, patt); } catch (ProductException e1) { // TODO Auto-generated catch block e1.printStackTrace(); System.out.println(e1.getMessage()); }
System.out.println("Enter the Price");
double prodPrice = scr.nextDouble();
System.out.println("Enter the Description");
String prodDes = scr.next();
Product prod = new Product();
// prod.setProductId(prodId);
prod.setProductName(prodName);
prod.setProductPrice(prodPrice);
prod.setProductDesc(prodDes);
//calling service layer...
try
{
msg = prodService.addProduct(prod);
}
catch (ProductException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e.getMessage());
}
if(msg == 0)
{
System.out.println("Data not Inserted....");
}else
{
System.out.println("Data Inserted with Product Id - " + msg);
}
break;
case 2: //show all
List
}
catch (ProductException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e.getMessage());
}
for (Product product : myProd) {
System.out.println("Id is " + product.getProductId());
System.out.println("Name is " + product.getProductName());
System.out.println("Price is " + product.getProductPrice());
System.out.println("Desc is " + product.getProductDesc());
}
break;
case 3: //Search
System.out.println("Enter Product Id.");
int id = scr.nextInt();
Product mySearchProd = null;
try {
mySearchProd = prodService.searchProduct(id);
}
catch (ProductException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e.getMessage());
}
System.out.println("Id is " + mySearchProd.getProductId());
System.out.println("Name is " + mySearchProd.getProductName());
System.out.println("Price is " + mySearchProd.getProductPrice());
System.out.println("Desc is " + mySearchProd.getProductDesc());
break;
case 4: //Remove
System.out.println("Enter Product Id.");
id = scr.nextInt();
try {
prodService.removeProduct(id);
} catch (ProductException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case 5: //exit
System.exit(0);
break;
default :
}
}
while (choice == 5 );
}
public static void printDetails()
{
System.out.println("**************");
System.out.println("1. ADD Product");
System.out.println("2. Show All Products");
System.out.println("3. Search Product");
System.out.println("4. Remove Product");
System.out.println("5. Exit");
System.out.println("**************");
}
}
package com.cg.pms.dao;
import java.util.List;
import com.cg.pms.dto.Product; import com.cg.pms.exception.ProductException;
public interface IProductDao
{
public int addProduct(Product pro) throws ProductException;
public List
package com.cg.pms.dao;
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List;
import org.apache.log4j.Logger;
import com.cg.pms.dto.Product; import com.cg.pms.exception.ProductException; import com.cg.pms.util.DbUtil;
public class ProductDaoImpl implements IProductDao { private static final Logger myLog = Logger.getLogger(DbUtil.class);
static Connection con = null;
static PreparedStatement pstm = null;
@Override
public int addProduct(Product pro) throws ProductException
{
int status = 0;
int idReturn = 0;
// TODO Auto-generated method stub
con = DbUtil.getConnection();
int prodId = getProductId();
String query = "INSERT INTO PRODUCTDB VALUES(?,?,?,?)";
try {
pstm = con.prepareStatement(query);
pstm.setInt(1,prodId);
pstm.setString(2,pro.getProductName());
pstm.setDouble(3,pro.getProductPrice());
pstm.setString(4,pro.getProductDesc());
status = pstm.executeUpdate();
if(status == 1)
{
idReturn = prodId;
myLog.info("Data Inserted");
}
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
try {
pstm.close();
con.close();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return idReturn;
}
@Override
public List<Product> showall() throws ProductException
{
List<Product> myList = new ArrayList<Product>();
con = DbUtil.getConnection();
String queryTwo = "SELECT prod_id,prod_name,prod_price,prod_des FROM PRODUCTDB";
try {
pstm = con.prepareStatement(queryTwo);
ResultSet res = pstm.executeQuery();
while(res.next())
{
Product pr = new Product();
pr.setProductId(res.getInt("prod_id"));
pr.setProductName(res.getString("prod_name"));
pr.setProductPrice(res.getDouble("prod_price"));
pr.setProductDesc(res.getString("prod_des"));
myList.add(pr);
}
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
throw new ProductException("Problem in Show");
}
finally
{
try {
pstm.close();
con.close();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return myList;
}
@Override
public Product searchProduct(int prodId) throws ProductException {
// TODO Auto-generated method stub
Product pSearch = null ;
try {
con = DbUtil.getConnection();
String queryThree = "SELECT prod_name,prod_price,prod_des FROM PRODUCTDB WHERE prod_id=?";
pstm = con.prepareStatement(queryThree);
pstm.setInt(1, prodId);
ResultSet resOne = pstm.executeQuery();
while (resOne.next())
{
pSearch = new Product();
pSearch.setProductName(resOne.getString("prod_name"));
pSearch.setProductPrice(resOne.getDouble("prod_price"));
pSearch.setProductDesc(resOne.getString("prod_des"));
}
}
catch (ProductException | SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
throw new ProductException("Problem in search...");
}
finally
{
try {
pstm.close();
con.close();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return pSearch;
}
@Override
public void removeProduct(int prodId) throws ProductException {
// TODO Auto-generated method stub
try {
con = DbUtil.getConnection();
String queryFour = "DELETE FROM PRODUCTDB WHERE prod_id=?";
pstm = con.prepareStatement(queryFour);
pstm.setInt(1, prodId);
pstm.executeQuery();
} catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
throw new ProductException("Problem in removing");
}
finally
{
try {
pstm.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static int getProductId() throws ProductException
{
int productId= 0;
try {
con = DbUtil.getConnection();
String queryFive = "SELECT prod_id_seq.nextval FROM DUAL";
pstm = con.prepareStatement(queryFive);
ResultSet resTwo = pstm.executeQuery();
while(resTwo.next())
{
productId = resTwo.getInt(1);
}
}
catch (ProductException | SQLException e)
{
e.printStackTrace();
throw new ProductException("provlem in getting or generating id");
}
return productId;
}
}
package com.cg.pms.dto;
public class Product { public Product() { super(); }
public Product(int productId, String productName, double productPrice,
String productDesc)
{
super();
this.productId = productId;
this.productName = productName;
this.productPrice = productPrice;
this.productDesc = productDesc;
}
private int productId;
private String productName;
private double productPrice;
private String productDesc;
public int getProductId() {
return productId;
}
public void setProductId(int productId)
{
this.productId = productId;
}
public String getProductName()
{
return productName;
}
public void setProductName(String productName)
{
this.productName = productName;
}
public double getProductPrice()
{
return productPrice;
}
public void setProductPrice(double productPrice)
{
this.productPrice = productPrice;
}
public String getProductDesc()
{
return productDesc;
}
public void setProductDesc(String productDesc)
{
this.productDesc = productDesc;
}
@Override
public String toString() {
return "Product [productId=" + productId + ", productName="
+ productName + ", productPrice=" + productPrice
+ ", productDesc=" + productDesc + "]";
} }
package com.cg.pms.exception;
public class ProductException extends Exception { public ProductException() { super(); } public ProductException(String msg) { super(msg); } }
package com.cg.pms.junitTest;
import static org.junit.Assert.*;
import java.sql.Connection; import java.sql.PreparedStatement;
import org.junit.After; import org.junit.Before; import org.junit.Test;
import com.cg.pms.dao.ProductDaoImpl; import com.cg.pms.dto.Product; import com.cg.pms.exception.ProductException;
public class ProductDaoTest
{
Connection con = null ;
PreparedStatement pstm = null;
Product prod = null;
ProductDaoImpl prodDao = null;
@Before
public void callBefore()
{
prod = new Product();
prod.setProductName("Heiniken");
prod.setProductPrice(250);
prod.setProductDesc("beer");
prodDao = new ProductDaoImpl();
}
@Test
public void myTestCase() throws ProductException
{
assertEquals(1018, prodDao.addProduct(prod));
}
@After
public void callAfter()
{
}
}
package com.cg.pms.service;
import java.util.List;
import com.cg.pms.dto.Product; import com.cg.pms.exception.ProductException;
public interface IProductService
{
public int addProduct(Product pro) throws ProductException;
public List
}
package com.cg.pms.service;
import java.util.List; import java.util.regex.Pattern;
import com.cg.pms.dao.IProductDao; import com.cg.pms.dao.ProductDaoImpl; import com.cg.pms.dto.Product; import com.cg.pms.exception.ProductException;
public class ProductServiceImpl implements IProductService { IProductDao prodDao = new ProductDaoImpl(); @Override public int addProduct(Product pro) throws ProductException { // TODO Auto-generated method stub return prodDao.addProduct(pro); }
@Override
public List<Product> showall() throws ProductException {
// TODO Auto-generated method stub
return prodDao.showall();
}
@Override
public Product searchProduct(int prodId) throws ProductException {
// TODO Auto-generated method stub
return prodDao.searchProduct(prodId);
}
@Override
public void removeProduct(int prodId) throws ProductException {
// TODO Auto-generated method stub
prodDao.removeProduct(prodId);
}
public static boolean validateName(String prodName, String prodPattern) throws ProductException
{
boolean validation = Pattern.matches(prodPattern, prodName);
if(!validation)
{
throw new ProductException("First letter should be capital min3 and max20");
}
return validation;
}
}
package com.cg.pms.util;
import java.io.FileInputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import org.apache.log4j.Logger;
import com.cg.pms.exception.ProductException;
public class DbUtil
{
private static final Logger mylogger = Logger.getLogger(DbUtil.class);
static Connection conn = null;
public static Connection getConnection() throws ProductException
{
try {
FileInputStream fileRead = new FileInputStream("oracle.properties");
Properties pros = new Properties();
pros.load(fileRead); // load properties file
String driver = pros.getProperty("oracle.driver");
String url = pros.getProperty("oracle.url");
String uname = pros.getProperty("oracle.username");
String upass = pros.getProperty("oracle.password");
//load the driver
Class.forName(driver);
//making connection
conn = DriverManager.getConnection(url,uname,upass);
mylogger.info("Connection estabhlished...");
}
catch (IOException | SQLException | ClassNotFoundException e)
{
e.printStackTrace();
mylogger.info("connection not estabhlished" + e);
throw new ProductException("Connection not Estabhlished..");
}
return conn;
}
}
log4j properties log4j.rootLogger=DEBUG, file
log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=application.log log4j.appender.file.MaxFileSize=5MB log4j.appender.file.MaxBackupIndex=10 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
oracle properties oracle.driver=oracle.jdbc.driver.OracleDriver oracle.url=jdbc:oracle:thin:@localhost:1521:xe oracle.username=system oracle.password=Capgemini123
Lab 11
package com.cg.mps.bean;
public class Mobile { private int Id; private String name; private double price; private int quantity;
public Mobile()
{
super();
}
public Mobile(int id, String name, double price, int quantity)
{
super();
this.Id = id;
this.name = name;
this.price = price;
this.quantity = quantity;
}
public int getid() {
return Id;
}
public void setid(int id) {
this.Id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@Override
public String toString() {
return "Mobiole id = " + Id + "\nName=" + name + "\nPrice="
+ price + "\nQuantity=" + quantity ;
}
}
package com.cg.mps.bean;
import java.sql.Date;
public class PurchaseDetails { private int purchaseId; private String cName; private String mailId; private long phoneNo; private Date purchaseDate; private int mobileID;
public PurchaseDetails()
{
super();
}
public PurchaseDetails(int purchaseId, String cName, String mailId,
long phoneNo, Date purchaseDate, int mobileID)
{
super();
this.purchaseId = purchaseId;
this.cName = cName;
this.mailId = mailId;
this.phoneNo = phoneNo;
this.purchaseDate = purchaseDate;
this.mobileID = mobileID;
}
public int getPurchaseId() {
return purchaseId;
}
public void setPurchaseId(int purchaseId) {
this.purchaseId = purchaseId;
}
public String getcName() {
return cName;
}
public void setcName(String cName) {
this.cName = cName;
}
public String getMailId() {
return mailId;
}
public void setMailId(String mailId) {
this.mailId = mailId;
}
public long getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(long phoneNo) {
this.phoneNo = phoneNo;
}
public Date getPurchaseDate() {
return purchaseDate;
}
public void setPurchaseDate(Date purchaseDate) {
this.purchaseDate = purchaseDate;
}
public int getMobileID() {
return mobileID;
}
public void setMobileID(int mobileID) {
this.mobileID = mobileID;
}
}
package com.cg.mps.dao;
import java.util.ArrayList;
import com.cg.mps.bean.Mobile; import com.cg.mps.bean.PurchaseDetails; import com.cg.mps.exception.MobilePurchaseException;
public interface IMobilePurchaseDao
{
public int addMobile(Mobile mob) throws com.cg.mps.exception.MobilePurchaseException;
public int addPurchase(PurchaseDetails pd) throws com.cg.mps.exception.MobilePurchaseException;
public ArrayList
package com.cg.mps.dao;
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar;
import com.cg.mps.bean.Mobile; import com.cg.mps.bean.PurchaseDetails; import com.cg.mps.util.DbUtil; import com.cg.mps.exception.MobilePurchaseException;
public class MobilePurchaseDaoImpl implements IMobilePurchaseDao { static Connection con = null; static PreparedStatement pstm=null; int status=0;
@Override
public int addMobile(Mobile mob) throws MobilePurchaseException
{
con = DbUtil.getConnection();
String query = "INSERT INTO mobiles VALUES(? , ? , ? , ?)";
try
{
pstm = con.prepareStatement(query);
pstm.setInt(1, mob.getid());
pstm.setString(2, mob.getName());
pstm.setDouble(3, mob.getPrice());
pstm.setInt(4, mob.getQuantity());
status = pstm.executeUpdate();
}
catch (SQLException e)
{
e.printStackTrace();
throw new MobilePurchaseException("Mobile cannot be saved..Domething went wrong");
}
finally
{
try
{
pstm.close();
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
return status;
}
@Override
public int addPurchase(PurchaseDetails pd) throws MobilePurchaseException
{
status = 0;
Connection conn = DbUtil.getConnection();
PreparedStatement prstm=null;
try
{
String queryone = "INSERT INTO purchasedetails VALUES(?,?,?,?,?,?)";
prstm = conn.prepareStatement(queryone);
int purcID = MobilePurchaseDaoImpl.getPurchaseId();
java.sql.Date date = new java.sql.Date(Calendar.getInstance().getTime().getTime());
prstm.setInt ( 1 , purcID );
prstm.setString( 2 , pd.getcName() );
prstm.setString( 3 , pd.getMailId() );
prstm.setLong( 4 , pd.getPhoneNo() );
prstm.setDate( 5 , date );
prstm.setInt( 6 , pd.getMobileID() );
status = prstm.executeUpdate();
if(status > 0)
status = purcID ;
}
catch (SQLException e)
{
e.printStackTrace();
throw new MobilePurchaseException("Purchase detail cannot be saved..Something went wrong");
}
finally
{
try
{
prstm.close();
conn.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
return status;
}
@Override
public ArrayList<Mobile> viewAllMob() throws MobilePurchaseException
{
return null;
}
@Override
public void deleteMobile(int id) throws MobilePurchaseException
{
}
@Override
public ArrayList<Mobile> viewMobRange(double low, double high)throws MobilePurchaseException
{
return null;
}
public static int getPurchaseId() throws MobilePurchaseException
{
int id=0;
try
{
con=DbUtil.getConnection();
String query = "SELECT seq_purchase.nextval FROM DUAL";
pstm = con.prepareStatement(query);
ResultSet rs = pstm.executeQuery();
if(rs.next())
{
id = rs.getInt(1);
}
}
catch ( SQLException e)
{
e.printStackTrace();
throw new MobilePurchaseException("error in retrieving id");
}
finally
{
try
{
pstm.close();
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
return id;
}
}
package com.cg.mps.exception;
public class MobilePurchaseException extends Exception {
public MobilePurchaseException()
{
super();
}
public MobilePurchaseException(String message, Throwable cause,
boolean enableSuppression, boolean writableStackTrace)
{
super(message, cause, enableSuppression, writableStackTrace);
}
public MobilePurchaseException(String message, Throwable cause)
{
super(message, cause);
}
public MobilePurchaseException(String message)
{
super(message);
}
public MobilePurchaseException(Throwable cause)
{
super(cause);
}
}
package com.cg.mps.service;
import java.util.ArrayList;
import com.cg.mps.bean.Mobile; import com.cg.mps.bean.PurchaseDetails; import com.cg.mps.exception.MobilePurchaseException;
public interface IMobilePurchaseService
{
public int addMobile(Mobile mob) throws MobilePurchaseException;
public int addPurchase(PurchaseDetails pd) throws MobilePurchaseException;
public ArrayList
}
package com.cg.mps.service;
import java.util.ArrayList;
import com.cg.mps.bean.Mobile; import com.cg.mps.bean.PurchaseDetails; import com.cg.mps.dao.IMobilePurchaseDao; import com.cg.mps.dao.MobilePurchaseDaoImpl; import com.cg.mps.exception.MobilePurchaseException;
public class MobilePurchaseServiceImpl implements IMobilePurchaseService { IMobilePurchaseDao daoObj = new MobilePurchaseDaoImpl();
@Override
public int addMobile(Mobile mob) throws MobilePurchaseException
{
return daoObj.addMobile(mob);
}
@Override
public int addPurchase(PurchaseDetails pd) throws MobilePurchaseException
{
return daoObj.addPurchase(pd);
}
@Override
public ArrayList<Mobile> viewAllMob() throws MobilePurchaseException
{
return daoObj.viewAllMob();
}
@Override
public void deleteMobile(int id) throws MobilePurchaseException
{
daoObj.deleteMobile(id);
}
@Override
public ArrayList<Mobile> viewMobRange(double low, double high) throws MobilePurchaseException
{
return daoObj.viewMobRange(low, high);
}
}
package com.cg.mps.ui;
import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import java.util.Scanner;
import com.cg.mps.bean.Mobile; import com.cg.mps.bean.PurchaseDetails; import com.cg.mps.exception.MobilePurchaseException; import com.cg.mps.service.IMobilePurchaseService; import com.cg.mps.service.MobilePurchaseServiceImpl;
public class MobilePurchaseUI {
public static void mainMenu()
{
System.out.println("**********************CHOOSE OPTION**********************");
System.out.println("1. Add new mobile");
System.out.println("2. Add new purchase entry");
System.out.println("3. View all available mobiles");
System.out.println("4. Delete mobile");
System.out.println("5. Search mobile based on range");
System.out.println("6. Exit");
System.out.println("*********************************************************");
Scanner sc = new Scanner(System.in);
int choice = sc.nextInt();
IMobilePurchaseService servObj = new MobilePurchaseServiceImpl();
switch (choice)
{
case 1:
System.out.println("Enter the mobile id :");
int id = sc.nextInt();
System.out.println("Enter mobile name : ");
String name = sc.next();
System.out.println("Enter the price : ");
double prc = sc.nextDouble();
System.out.println("Enter the Quantity : ");
int qntty = sc.nextInt();
Mobile mob = new Mobile(id, name, prc, qntty);
try
{
servObj.addMobile(mob);
}
catch (MobilePurchaseException e)
{
e.printStackTrace();
}
break;
case 2:
System.out.println("Enter customer name : ");
String cname = sc.next();
System.out.println("Enter mail ID : ");
String email = sc.next();
System.out.println("Enter phone number");
long phone = sc.nextLong();
System.out.println("Enter mobile Id");
int mobId = sc.nextInt();
PurchaseDetails pd = new PurchaseDetails();
pd.setcName(cname);
pd.setMailId(email);
pd.setPhoneNo(phone);
pd.setMobileID(mobId);
try
{
servObj.addPurchase(pd);
}
catch (MobilePurchaseException e)
{
e.printStackTrace();
}
break;
case 3:
try
{
ArrayList<Mobile> mobData = servObj.viewAllMob();
for (Mobile mobile : mobData)
{
System.out.println(mobile + "\n");
}
}
catch (MobilePurchaseException e)
{
e.printStackTrace();
}
break;
case 4:
break;
case 5:
break;
case 6:
System.exit(0);
break;
default:
break;
}
}
}
package com.cg.mps.ui;
public class MyMain { public static void main(String[] args) { while(true) { MobilePurchaseUI.mainMenu(); } } }
package com.cg.demotwo.ui; import java.io.FileInputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Properties; import java.util.Scanner;
public class getting_dat_DBMS { public static void main(String[] args) { try { FileInputStream fileRead = new FileInputStream("oracle.properties"); Properties pros = new Properties(); pros.load(fileRead); //load properties file
}