Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bank;
- import java.sql.*;
- public class DBOperations {
- public static Connection connect( boolean local) throws SQLException{
- Connection connection = null;
- String username;
- String password;
- if(local){
- username="root";
- password="";
- connection = DriverManager.getConnection(
- //"jdbc:oracle:thin:@localhost:1521/xe", username, //moj adres IP
- "jdbc:mysql://127.0.0.1:3306/bank", username, //moj adres IP
- password);//open the connection
- }
- else{ //logowanie do bazy w necie - DONOT supported YET
- username="pwr_16_17_L_015226029";
- System.out.println("jest konekcja pozalokalna");
- // prawie zapomniałem usunac haslo
- password="";
- connection = DriverManager.getConnection(
- "jdbc:oracle:thin:@156.17.43.90:1521:xe", username, //serwer Pwr
- password);//open the connection
- }
- return connection;
- }
- // metoda nieuzywana, a moznaby
- public static void checkLib() throws ClassNotFoundException{
- Class.forName("oracle.jdbc.driver.OracleDriver");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement