Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package pbo2;
- import java.sql.*;
- import java.util.logging.*;
- /**
- *
- * @author admin
- */
- public class PBO2 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- String host = "172.23.9.185";
- String port = "1521";
- String sid = "orcl";
- String user = "MHS175314019";
- String password = "MHS175314019";
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@"+host+":"+port+":"+sid,user,password);
- String query = "select employee_id, first_name, last_name, email from employees";
- Statement st = conn.createStatement();
- ResultSet rs = st.executeQuery(query);
- } catch (ClassNotFoundException ex) {
- System.out.println(ex.toString());
- } catch (SQLException ex) {
- System.out.println(ex.toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement