Package java.sql

Examples of java.sql.Connection.prepareCall()


      CallableStatement st = null;
      try {
         String sql = "{? = call " + this.replPrefix + "check_structure()}";
         conn = this.dbPool.reserve();
         conn.setAutoCommit(true);
         st = conn.prepareCall(sql);
         st.registerOutParameter(1, Types.VARCHAR);
         st.executeQuery();
      }
      catch (Exception ex) {
         conn = removeFromPool(conn, ROLLBACK_NO);
View Full Code Here


            log.info("table '" + tableName + "' is already registered, will add directly an entry in the ENTRIES Table");
            String destAttrName = "?";
            if (destinations == null || destinations.length == 0)
               destAttrName = "NULL";
            String sql = "{? = call " + this.replPrefix + "check_tables(NULL,?,?,?," + destAttrName + ")}"; // name text, content text)
            CallableStatement st = conn.prepareCall(sql);
            st.setString(2, schema);
            st.setString(3, tableName);
            st.setString(4, ReplicationConstants.CREATE_ACTION);
            if (destinations != null && destinations.length != 0) {
               String post = "</desc>";
View Full Code Here

               buf.append("<attr id='").append(ReplicationConstants.STATEMENT_ID_ATTR).append("'>").append(statementId).append("</attr>\n");
               buf.append("<attr id='").append(ReplicationConstants.SQL_TOPIC_ATTR).append("'>").append(sqlTopic).append("</attr>\n");
               // buf.append("</desc>\n");
              
               String sqlTxt = "{? = call " + this.replPrefix + "prepare_broadcast(?)}";
               st = conn.prepareCall(sqlTxt);
               String value = buf.toString();
               st.setString(2, value);
               st.registerOutParameter(1, Types.VARCHAR);
               st.executeQuery();
            }
View Full Code Here

    Connection conn = null;
    CallableStatement cStmt = null;
    int numUpdated = 0;
    try {
      conn = dataSource.getConnection();
      cStmt = conn.prepareCall("{call addImportFolder(?,?)};");     
      for(Folder folder : folders){
        cStmt.setInt(1,subscription.getId());
        cStmt.setInt(2,folder.getId());       
        cStmt.addBatch();       
      }     
View Full Code Here

    Connection conn = null;
    CallableStatement cStmt = null;
    int id = -1;
    try {
      conn = dataSource.getConnection();
      cStmt = conn.prepareCall("{call createSubscription(?,?,?,?,?,?)}");
      cStmt.setInt(1,subscription.getBookmark().getId());
      Date lastSync = subscription.getLastSync();
      if(lastSync != null){
        cStmt.setTimestamp(2,new Timestamp(lastSync.getTime()));
      }else{
View Full Code Here

    DaoResult<FeedSubscription> result = null;
    CallableStatement cStmt = null;
    Connection conn = null;
    try{           
      conn = dataSource.getConnection();
      cStmt = conn.prepareCall("call pageSubscriptionByOwnerId(?,?,?,?);");
      cStmt.setInt(1,user.getId());
      cStmt.setInt(2,offset);
      cStmt.setInt(3,count);
      cStmt.registerOutParameter(4,Types.INTEGER);
      ResultSet rs = cStmt.executeQuery();
View Full Code Here

    Connection conn = null;
    CallableStatement cstmt = null;
    int numUpdated = 0;
    try {
      conn = dataSource.getConnection();
      cstmt = conn.prepareCall("call removeImportFolder(?,?)");
      int feedId = subscription.getId();   
      for(Folder folder : folders){
        cstmt.setInt(1,feedId);
        cstmt.setInt(2,folder.getId());       
        cstmt.addBatch();
View Full Code Here

    List<FeedSubscription> feeds = new ArrayList<FeedSubscription>();   
    CallableStatement cStmt = null;
    Connection conn = null;
    try{           
      conn = dataSource.getConnection();
      cStmt = conn.prepareCall("call findAutoImportSubscription(?);");     
      cStmt.setInt(1,ageHour);
      cStmt.execute();
      ResultSet rs = cStmt.executeQuery();
      while(rs.next()){
        FeedSubscription feed = createFeedSubscriptionObject(rs);       
View Full Code Here

    CallableStatement cStmt = null;
    Connection conn = null;
    int userId = -1;
    try{
      conn = datasource.getConnection();
      cStmt = conn.prepareCall("{call createUser(?,?,?,?,?,?,?)}");
      cStmt.setString(1,user.getUsername());
      cStmt.setString(2,user.getPassword());
      cStmt.setString(3,user.getFullname());
      cStmt.setString(4,user.getEmail());
      cStmt.setTimestamp(5,new Timestamp(user.getCreatedOn().getTime()));
View Full Code Here

    Connection conn = null;
    CallableStatement cStmt = null;
    int id = -1;
    try {
      conn = dataSource.getConnection();
      cStmt = conn.prepareCall("{call createLink(?,?,?)}");
      cStmt.setString(1,link.getUrl());
      cStmt.setInt(2,link.getMimeTypeId());
      cStmt.registerOutParameter(3,Types.INTEGER);
      cStmt.execute();
      id = cStmt.getInt(3);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.