Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 93780 invoked from network); 14 Jul 2010 13:44:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Jul 2010 13:44:29 -0000 Received: (qmail 21806 invoked by uid 500); 14 Jul 2010 13:44:29 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 21390 invoked by uid 500); 14 Jul 2010 13:44:26 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 21375 invoked by uid 99); 14 Jul 2010 13:44:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jul 2010 13:44:25 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jul 2010 13:44:18 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OZ2Fi-0001Vs-1s for users@activemq.apache.org; Wed, 14 Jul 2010 06:43:58 -0700 Message-ID: <29162123.post@talk.nabble.com> Date: Wed, 14 Jul 2010 06:43:58 -0700 (PDT) From: manua To: users@activemq.apache.org Subject: AMQ consumer, gives exception when executing query from mysql MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: agarwal.manu@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Hi All, My consumer gives unknown exception at, mysqlpp::StoreQueryResult res = query.store()). ON receiving the test message, I ma parsing and passing it to a function, which will dip the database on the basis of that parameter and returns the result. I am able to parse the message and pass it to the required function.In the function, its able to connect to the database, but on query it gives the following exception, caught unknown exception FILE: activemq/core/ActiveMQConsumer.cpp, LINE: 987 FILE: activemq/core/ActiveMQSessionExecutor.cpp, LINE: 133 Please find below a code snippet of my code, =============================================================================== void onTicks( void *msg ){ cout << get_ref_data("C"); cout << "Msg received : " << endl; const TextMessage* txtMessage = dynamic_cast< const TextMessage* >( (Message *)msg ); string s1 = txtMessage->getText(); istringstream is1(s1); Stream_reader reader(is1); mValue value; reader.read_next(value); mObject& O = value.get_obj(); for(mObject::iterator it=O.begin();it != O.end();++it){ cout <first; if(!(it)->first.compare("Portfolio")){ mArray& a = O["Portfolio"].get_array(); for(int i=0;i(); try{ get_ref_data(t); throw 0; }catch(const int n){ cout << "Caught error " << n << endl; }.... .............. =============================================================================== int get_ref_data(string s){ mysqlpp::Connection conn; if (conn.connect("SecurityMaster", "localhost", "proddbuser", "proddblander")) { cout << "DB Connected" << " string received : " << s << endl; mysqlpp::Query query = conn.query(); query << "SELECT * FROM table where symbol=" << s << " and date='20100628'"; if (mysqlpp::StoreQueryResult res = query.store()) { cout << "Query Data:" << endl; for (size_t i = 0; i < res.num_rows(); ++i) { cout << '\t' << res[i][0] << " , "<< res[i][1] << " , "<< res[i][2] << " , "<< res[i][3] << " , "<< res[i][4] << endl; } }else{ cout << "Couldn't execute the query"; } } cout <<"query complete " << endl; return 1; } =============================================================================== Its connected to db, but after that gives error. DB Connected string received : C caught unknown exception FILE: activemq/core/ActiveMQConsumer.cpp, LINE: 987 FILE: activemq/core/ActiveMQSessionExecutor.cpp, LINE: 133 =============================================================================== What could be the reason for this or if I have to do it in a different way. Kindly let me know your inputs. Thanks, Manu -- View this message in context: http://old.nabble.com/AMQ-consumer%2C-gives-exception-when-executing-query-from-mysql-tp29162123p29162123.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.