code: public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
          SHPDriverFunction shpDriverFunction = new SHPDriverFunction();
          shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding);
      }
docs: Read a table and write it into a shape file.
  @param connection Active connection
  @param fileName Shape file name or URI
  @param tableReference Table name or select query
  Note : The select query must be enclosed in parenthesis
  @param encoding File encoding
  @throws IOException
  @throws SQLException