1. Make a copy of the execsql.cpp program from Section 28.4.3. Examine the call to the mysql_real_connect function inside the main function:
    if (mysql_real_connect(connection, NULL, NULL, NULL,
       "bigcpp", NULL, 0, NULL) == NULL)

    If you need to connect to a remote database or a database with multiple users, change the first three NULL arguments to strings denoting the host server, the database user name, and the password

  2. Locate the directories for the header file mysql.h and the mysqlclient library files. They should be in the include and lib subdirectories of the MySQL installation directory. Add the path of the header file directory to your compiler's header file directories. Add the library to your compiler's libraries. Compile the execsql program. For example, on Linux, you use the command
    g++ -o execsql -I /usr/local/mysql/include execsql.cpp
       -L /usr/local/mysql/lib -lmysqlclient -lz
  3. Locate the file test.sql that contains the same SQL instructions as the database test in Step 6 above. It is included with the code distribution for this book. Then run the command
    execsql < test.sql

    The program should print Romeo, the same output as with the first database test. If this test passes, then you are ready to run the programs of the next section.

    If your program doesn't work, there are several possible causes.