Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //establishing MYSQL connection
- Connection conn = null;
- try {
- conn = DriverManager.getConnection("jdbc:mysql://192.168.0.151/" + mysql_db, mysql_usr, mysql_pwd);
- } catch (SQLException ex) {
- System.out.println("SQLException: " + ex.getMessage());
- System.out.println("SQLState: " + ex.getSQLState());
- System.out.println("VendorError: " + ex.getErrorCode());
- }
- finally {
- //MYSQL query
- Statement stmt = null;
- ResultSet rs = null;
- Array arResult = null;
- try {
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM panp_source");
- arResult = rs.getArray("url");
- } catch (SQLException ex) {
- System.out.println("SQLException: " + ex.getMessage());
- System.out.println("SQLState: " + ex.getSQLState());
- System.out.println("VendorError: " + ex.getErrorCode());
- }
- finally {
- if (rs != null)
- rs.close();
- if (stmt != null)
- stmt.close();
- }
- System.out.print(arResult.toString());
- if (conn != null)
- conn.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement