Sql Server Calling Stored Procedures

Sql Server Calling Stored Procedures

Sql Server Calling Stored Procedures

One of the most powerful combinations that any programmer can use is the combination of C++ and MySQL - a flexible programming language with a multi-platform and stable database; but this may seem an intimidating task to the new software developer.

It's not. This article will show just how easy it is for a programmer to use C++ to:

  • set up a connection to a MySQL database
  • use the C++ code to access an MySQL stored function
  • display the results returned by the MySQL stored function
  • and (perhaps most importantly) handle any errors

Setting up Test Data in a MySQL Database

Before a programmer can use a database that database must, of course, exist; or, at very least, a test database must exist. Fortunately creating a database in MySQL is very simple and consists of three steps:

  1. log on to MySQL
  2. use SQL to create the MySQL database and any tables
  3. populate the tables with appropriate data

The first step (logging on to MySQL) can be done from the command line: