Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:25:59+00:00 2026-06-14T08:25:59+00:00

I am trying to use transactions in the Zend Framework and have a working

  • 0

I am trying to use transactions in the Zend Framework and have a working script.

However, under testing I noticed that a try/catch function will catch any exception except one caused by the Mysql server being inactive.

Is this supposed to happen? If my server crashes I am worried that an ugly Zend exception would be returned and the application would cease to fail gracefully.

My code looks like this:

function insertInbox ($userId, $mail_id )
{   

    $db = Zend_Db_Table::getDefaultAdapter();  

    $table = new Application_Model_DbTable_Inbox; 

    try {
        $db->beginTransaction();

        $data = array (
                   'user_id'    => $userId,
                   'mail_id'    => $mail_id
                   );

        $insertedId[] = $table -> insert($data);

        $db -> commit();

        return $insertedId;
        }

    catch(exception $e){ 
        $db->rollback();
        return "insert failed";//.$e;
        }   
}

$tt = insertInbox ( 666,666);   
print_r($tt);

A duplicate entry of similar exception is caught and the temporary custom error message –insert failed– is returned. But if I turn off the database server the php catch does not capture this error:

**Message:** SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.

Any thoughts appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:26:01+00:00Added an answer on June 14, 2026 at 8:26 am

    Some database extensions of PHP try to create a database connection when none is established and a function is called, that requires one. In this case $db->rollback() itself throws an exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the BrainTree webhooks for subscription transactions but have been
Hi I am trying to use transactions along with Entity Framework. With so much
I am trying use gem tire to search in my application. I have tables
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am trying to use paypal simply to handle my credit card transactions. I
I have been trying to use temporary tables along with nhibernate. The following piece
I'm trying to use factory_girl to create a user factory (with RSpec) however it
Trying to figure out how to manage/use long-living DB connections. I have too little
I'm trying to use Django transactions on MySQL with the commit_on_success decorator . According
I am trying to use Informix database with a Play! Framework application. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.