
package dbconnection;
import java.sql.*;
public class DbConnection {
Connection con ;
public Connection getCon() {
return con;
}
String url = "jdbc:oracle:thin:@172.24.137.30:1521:ORA10G";
String username = "e542435";
String password = "zAybjubsL";
static DbConnection dbconnectionfactory = null;
private DbConnection()throws Exception{
Class.forName("oracle.jdbc.OracleDriver");
con = DriverManager.getConnection(url,username,password);
}
public static Connection getDBConnection(){
if(dbconnectionfactory == null){
try {
dbconnectionfactory = new DbConnection();
} catch(Exception e){
e.printStackTrace();
}
}
return dbconnectionfactory.getCon();
}
}

215
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.