Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Jdbc {
- public Connection connection;
- public Jdbc() {
- try{
- Class.forName("oracle.jdbc.driver.OracleDriver");
- connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","DENIS","DENIS");
- connection.setAutoCommit(false);
- }catch(Exception e) {
- System.out.println("Error : " + e);
- }
- }
- public void executeQuery(String stringParam){
- ResultSet rs;
- try (Statement stmt = connection.createStatement()) {
- rs = stmt.executeQuery(stringParam);
- while(rs.next())
- System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
- }catch(Exception e){
- System.out.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement