[URGENT HELP - S.O.S.] WINXP + VS 2008 + C++ = Uncontrolled Exception
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [URGENT HELP - S.O.S.] WINXP + VS 2008 + C++ = Uncontrolled Exception

  1. #1
    Join Date
    Jul 2009
    Posts
    8

    [URGENT HELP - S.O.S.] WINXP + VS 2008 + C++ = Uncontrolled Exception

    Hello, i need urgent help because i'm obtaining a error that i don't understand.

    I have to develop a win 32 application that connects to a mysql bd. After try to develop with some IDE i have decided to develop with Visual Studio 2008 because i want to use qt interfaces and VS 2008 have an add-in with this purpose.

    I have followed the instalation process of the this web:

    http://dev.mysql.com/doc/refman/6.0/...al-studio.html

    And i have tryed the complete example of this page:

    http://dev.mysql.com/doc/refman/6.0/...example-1.html

    Here start the problems. Firts of all i have tryed to run this example with visual c++ 2008 express edition and everything runs ok. Then i have tryed to develop an example with qt libraries in visual c++ and i get some problems with it. So i find that there is and add-in to use qt with the complete visual studio. And i tryed and it works perfect. The problem is when i try to use the example of mysql with microsoft visual studio 2008. When i develop the example i get this error:

    "Exception not controlled in 0x0042e081 in prueba2.exe: 0xC0000005: Acces infraction when reading the ubication 0x0000000f."

    I don't understant why works on visual c++ 2008 and not in visual studio 2008... I do everything equals in both versions... Trying to resolve this i add a catch at the code (you can see the code at the end of the post), but there weren't satisfactory results.

    Thank you very much, i hope to somebody helps me!!!

    Imanol.

    LAST CODE USED:
    // prueba2.cpp: define el punto de entrada de la aplicación de consola.
    //

    #include "stdafx.h"



    /*int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }
    */

    /* Copyright 2008 Sun Microsystems, Inc.

    This program is free software; you can redistribute it and/or modify
    it under only the terms of the GNU General Public License as published by
    the Free Software Foundation; version 2 of the License.

    There are special exceptions to the terms and conditions of the GPL
    as it is applied to this software. View the full text of the
    exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this
    software distribution.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    */

    /* Standard C++ includes */
    #include <stdlib.h>
    #include <iostream>

    /*
    Include directly the different
    headers from cppconn/ and mysql_driver.h + mysql_util.h
    (and mysql_connection.h). This will reduce your build time!
    */
    #include "mysql_connection.h"

    #include <cppconn/driver.h>
    #include <cppconn/exception.h>
    #include <cppconn/resultset.h>
    #include <cppconn/statement.h>

    using namespace std;

    int _tmain(void)
    {
    cout << endl;
    cout << "Running 'SELECT 'Hello World!' AS _message'..." << endl;

    try {
    sql:river *driver;
    sql::Connection *con;
    sql::Statement *stmt;
    sql::ResultSet *res;

    /* Create a connection */
    driver = get_driver_instance();
    con = driver->connect("tcp://127.0.0.1:3306", "root", "123456");
    /* Connect to the MySQL test database */
    con->setSchema("jedi");

    stmt = con->createStatement();
    res = stmt->executeQuery("SELECT * FROM autores");
    while (res->next()) {
    cout << "\t... MySQL replies: ";
    /* Access column data by alias or column name */
    cout << res->getString("nombre") << endl;
    cout << "\t... MySQL says it again: ";
    /* Access column fata by numeric offset, 1 is the first column */
    cout << res->getString("user") << endl;
    }
    delete res;
    delete stmt;
    delete con;

    } catch (sql::SQLException &e) {
    cout << "# ERR: SQLException in " << __FILE__;
    cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
    cout << "# ERR: " << e.what();
    cout << " (MySQL error code: " << e.getErrorCode();
    cout << ", SQLState: " << e.getSQLState() << " )" << endl;
    } catch (std::exception &e){
    cout<< "excetpion";
    }

    cout << endl;

    return EXIT_SUCCESS;
    }

  2. #2
    Join Date
    Apr 1999
    Posts
    27,427

    Re: [URGENT HELP - S.O.S.] WINXP + VS 2008 + C++ = Uncontrolled Exception

    Code:
    delete res;
    delete stmt;
    delete con;
    Where are the calls to "new"?

    Also, please use code tags when posting code.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Jul 2009
    Posts
    8

    Re: [URGENT HELP - S.O.S.] WINXP + VS 2008 + C++ = Uncontrolled Exception

    Hello, thanks to answer me.. I'm sorry for not using code tags I didn't think about it...

    I tryed what you said, but i get the same problem. In the page of mysql said that you have to delete the instances after.. i don't know why 'cause there aren't any "new"...

    I can't understand why works the same example in Visual C++ 2008 and not in Visual Studio 2008...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center