SHARE
TWEET

Untitled

a guest Apr 27th, 2016 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.sneiders;
  2.  
  3.  
  4. import java.sql.*;
  5.  
  6. public class MySQLTest {
  7.  
  8.   public static void main(String[] args) {
  9.  
  10.     Connection connection = null;
  11.     Statement statement = null;
  12.  
  13.     try {
  14.       connection = DriverManager.getConnection(
  15.               "jdbc:mysql://info.rnd.impresa.pt:3306/escapev3",
  16.               "root",
  17.               "123456");
  18.       statement = connection.createStatement();
  19.       ResultSet rs = statement.executeQuery("select field_report_value from content_field_report where nid=19906230");
  20.       if (rs.next()) {
  21.  
  22.         String value = rs.getString(1);
  23.         value = value.replaceAll("\ufeff", "");
  24.         System.out.println(value);
  25.        
  26.       }
  27.      
  28.     } catch (SQLException e) {
  29.       e.printStackTrace();
  30.     } finally {
  31.       if (connection != null) {
  32.         try {
  33.           connection.close();
  34.         } catch (SQLException e) {
  35.           e.printStackTrace();
  36.         }
  37.       }
  38.       if (statement != null) {
  39.         try {
  40.           statement.close();
  41.         } catch (SQLException e) {
  42.           e.printStackTrace();
  43.         }
  44.       }
  45.     }
  46.    
  47.   }
  48.  
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top