User talk:Sandeepmchouhan

package com.capgemini.core.supriyo.mps.util;

import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.Properties;

import oracle.jdbc.pool.OracleDataSource;

//singleton class public class DBUtil { //factory class

private static OracleDataSource ods; static{ try { ods=new OracleDataSource; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace; }	}	public static Connection getConnection throws SQLException{ String filePath="D:\\SupriyoJAVA\\MobilePurchaseSystem\\resources"; String fileName="Database.properties"; FileReader reader=null; Properties properties=null; Connection connection; try { reader = new FileReader(filePath+"\\"+fileName); properties=new Properties; properties.load(reader); connection = null; } catch (FileNotFoundException e) { e.printStackTrace; } catch (IOException e) { e.printStackTrace; }finally{ try { reader.close; } catch (IOException e) { e.printStackTrace; }			}			ods.setUser(properties.getProperty("userName")); ods.setPassword(properties.getProperty("password")); ods.setDriverType("thin"); ods.setNetworkProtocol("tcp"); ods.setURL(properties.getProperty("url")); connection=ods.getConnection; return connection; }	public static void main(String[] args) throws SQLException, IOException { Connection connection=DBUtil.getConnection; if(connection!=null){ System.out.println(connection.getMetaData.getDatabaseProductName); }		else{ System.out.println("connection not successful"); }	} }

hiii..................i got it \

Hello