public static boolean addContact(ContactBean contact) {
      boolean good = true;

      try {
         ResultSet rset = null;
         PreparedStatement stmt = null;

         // first: add the contact in the contact table
         {
            String statementName = "addContact";
            SQLConnManager connMgr = new SQLConnManager(statementName, new ErrorBean());

            try {
               // Get database connection
               if ((connMgr.getConn()) == null) {
                  good = false;
               }
               else {
                  // Load up the correct SQL statement
                  stmt = connMgr.loadPreparedStatement(statementName);
                  stmt.setString(1, contact.getFirstname());
                  stmt.setString(2, contact.getLastname());
                  stmt.setString(3, contact.getNickname());
                  stmt.setInt(4,(contact.isActive() ? 1 : 0));
                  stmt.setString(5, contact.getDistinctInfo());
                  stmt.setString(6, contact.getPhoneticCode());
                  stmt.setString(7, contact.getNote());
                  stmt.setInt(8,(contact.isVoicemailEnabled() ? 1 : 0));
                  stmt.setString(9, contact.getAudioName());
                  stmt.setString(10, contact.getEmail());
                  stmt.executeUpdate();
               }
            }
            catch (Exception e) {
               good = false;
               UtilBundle.log.logMessage(e, statementName, LogUtil.SEVERE);
            }
            // Free resources allocated.
            connMgr.shutDown(true);
         }
         // second: get the contact_id
         {
            String statementName = "lookupLastContactId";
            SQLConnManager connMgr = new SQLConnManager(statementName, new ErrorBean());

            try {
               // Get database connection
               if ((connMgr.getConn()) == null) {
                  good = false;
               }
               else {
                  stmt = connMgr.loadPreparedStatement(statementName);
                  rset = stmt.executeQuery();
                  if(rset.next()) {
                     contact.setContactId(rset.getInt(1));
                     ////
                     //System.out.println("the id for the added Contact: " + rset.getInt(1));
                     ////
                  }
               }
            }
            catch (Exception e) {
               good = false;
               UtilBundle.log.logMessage(e, statementName, LogUtil.SEVERE);
            }
            // Free resources allocated.
            connMgr.shutDown(true);
         }
         // third: add the mobilePhoneNumber in the phonenumber table
         addPhoneNumber(contact, PhoneNumberBean.PHONETYPEID_MOBILE);

         // fourth: add the workPhoneNumber in the phonenumber table
         addPhoneNumber(contact, PhoneNumberBean.PHONETYPEID_WORK);
         
         addPhoneNumber(contact, PhoneNumberBean.PHONETYPEID_HOME);
         
         addPhoneNumber(contact, PhoneNumberBean.PHONETYPEID_EXTENSION);
      }
      catch (Exception e) {
         good=false;
         e.printStackTrace(System.err);
      }
      return good;
   }