Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DBConnection {
- public Connection connection;
- public Statement st;
- public void dbConnection(){
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- try {
- connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "OSPEDALE", "marcopolo");
- //System.out.println(connection);
- } catch (SQLException e) {
- System.out.println("Connection Failed!");
- e.printStackTrace();
- }
- if (connection != null) {
- //System.out.println("Database connected.");
- } else {
- System.out.println("Failed to make connection.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement