Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.seed;
- import java.io.FileReader;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.util.Properties;
- public class connprovider {
- static Connection con;
- public static Connection getConnectionWithDB()
- {
- try{
- FileReader fr=new FileReader("dbinfo.properties");
- Properties pr=new Properties();
- pr.load(fr);
- String username=pr.getProperty("un");
- String password=pr.getProperty("password");
- Class.forName("oracle.jdbc.driver.OracleDriver");
- con=DriverManager.getConnection(pr.getProperty("path_url"),username,password);
- //con=DriverManager.getConnection("jdbc:oracle:thin:@tcet-PC:1521:XE","scott","TIGER");
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- return con;
- }
- }
Add Comment
Please, Sign In to add comment