Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.CallableStatement;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Types;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.sql.PreparedStatement;
- import java.sql.CallableStatement;
- import java.sql.Struct;
- import java.sql.Array;
- import java.math.BigDecimal;
- import java.sql.*;
- public class testJava {
- public static void main(String[] args) throws Exception {
- Class.forName("com.edb.Driver");
- Connection connection = null;
- String st = null;
- String url = "jdbc:edb://127.0.0.1:5432/mc";
- String user = "enterprisedb";
- String password = "o1234";
- connection = DriverManager.getConnection(url,user,password);
- try {
- String commandText = "SELECT file FROM xmltest";
- PreparedStatement cs = connection.prepareStatement(commandText);
- ResultSet rs = cs.executeQuery();
- while (rs.next()) {
- String s = rs.getString("file");
- System.out.println("File: " + s);
- }
- } catch (SQLException ex)
- {
- System.out.println("State: " + ex.getSQLState() +
- "\nMessage: " + ex.getMessage());
- }
- finally {
- try {
- if (connection != null)
- {
- connection.close();
- }
- } catch (SQLException ex)
- {
- System.out.println(ex);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement