If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Re : Server connectivity with c++ application

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-11, 10:38
Antrikssh Antrikssh is offline
Registered User
 
Join Date: Oct 2011
Posts: 8
Question 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.
Reply With Quote
  #2 (permalink)  
Old 10-24-11, 12:29
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
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
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old 10-25-11, 04:30
Antrikssh Antrikssh is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On