Package com.google.cloud.sql.jdbc

Examples of com.google.cloud.sql.jdbc.PreparedStatement


    try {
      Connection conn = null;
      DriverManager.registerDriver(new AppEngineDriver());
      conn = DriverManager.getConnection("jdbc:google:rdbms://pcni.org:openhmis:openciss/compass");
      String stmt = "SELECT program_key, program_name, agency_name, program_type, site_geocode, target_pop_a_name, update_time_stamp, units_total, units_available, units_occupied, contact_name, contact_phone, program_address, program_city, program_zip, program_address_full FROM compass.program_profile_info WHERE program_key=?";
      PreparedStatement pstmt = (PreparedStatement)conn.prepareStatement(stmt);
//      try {
//        System.out.println("value=[" + idStr + "]; bytes=" + Arrays.toString(idStr.getBytes("UTF-8")));
//      } catch (UnsupportedEncodingException e) {
//        e.printStackTrace();
//      }
      pstmt.setString(1, id);
      //pstmt.setString(1, "3459");
      pstmt.toString();
      ResultSet rs = pstmt.executeQuery();
      int i = 0;
      while (rs.next()) {
        JsonNode recordNode = mapper.createObjectNode(); // will be of type ObjectNode
        ((ObjectNode)recordNode).put("ProgramKey", rs.getString("program_key"));
        ((ObjectNode)recordNode).put("ProgramName", rs.getString("program_name"));
View Full Code Here

TOP

Related Classes of com.google.cloud.sql.jdbc.PreparedStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.