Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    8

    Question Unanswered: Re : Server connectivity with c++ application

    Hello Everyone,

    This is Antrikssh Mishra , I have created one application in c++ and using Eclipse with fedora 15 o/s I just build it and run it .my application build successfully but not connect to the server when I debug it then it shows following errors :

    No source available for "sql::mysql::MySQL_Connection::init() at 0x14224c"

    when I debug my code the code is debug perfectly but it fail at that point is show below.

    pcHostName = "localhost"
    pcUserName = "admin"
    pcPassword = "user"
    pcDBName = "MyDbase"

    int iRetVal = 0;

    // try block to establish a connection
    try {

    // load the drivers
    poDriver = get_driver_instance();

    // create a connection to the MySQL package
    poConn = poDriver->connect(pcHostName, pcUserName, pcPassword);

    // Connect to the MySQL database
    poConn->setSchema(pcDBName);

    // catch block to trap the exception and return error unable to access
    // database
    } catch (SQLException oSQLExecept) {
    iRetVal =1;
    }

    return iRetVal;
    }

    After the highlighted line my code produce error before it worked perfectly.


    Thanks and Regards,
    Antrikssh Mishra.

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    What is the function get_driver_instance(); supposed to return? I would test to make sure that this is returning the correct values. Sometimes the line that fails is a result of improper data returned from a previous function. In your case you are using poDriver and you need to make sure that this has a correct value before proceeding with the connection.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Oct 2011
    Posts
    8

    Question

    Hello,

    Sir I have re-debug my code and get the poDriver value that is


    this * DB_Connection * const 0x807a288
    poDriver sql:: Driver * 0x807a340
    poConn sql:: Connection * 0x0
    poStmt sql:: Statement * 0x0
    poPrpdStmt sql::PreparedStatement * 0x0

    HostName const char * 0x806d03f "localhost"
    UserName const char * 0x806d03e "admin"


    poDriver
    Details:0x807a340
    Default:0x807a340
    Decimal:134718272
    Hex:0x807a340
    Binary:1000000001111010001101000000
    Octal:01001721500

    Name : poConn
    Details:0x0
    Default:0x0
    Decimal:0

    Name : poStmt
    Details:0x0
    Default:0x0
    Decimal:0
    Hex:0x0

    Name : poPrpdStmt
    Details:0x0
    Default:0x0
    Decimal:0
    Hex:0x0
    Hex:0x0

    According to you what will be the value of poDriver.


    Thanks and Regards,

    Antrikssh Mishra.

Posting Permissions

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