Chapter 3. Preselect the driver and user information
Prev |  | Next

## Chapter 3. Preselect the driver and user information

Isn't it disturbing, that you have to select the database driver interactively? To stop it change the first part of your code:

Example 3.1. Preselect the driver and user information

    #define HAVE_SSTREAM 1
    #include <hk_classes.h>
    #include <iostream>
    int main()
    {
       hk_drivermanager* mydrivermanager = new hk_drivermanager();
       if (mydrivermanager==NULL) {cout <<"error creating mydrivermanager"<<endl;exit(1);}
       hk_connection* myconnection = mydrivermanager->new_connection("mysql");
       if (myconnection==NULL) {cout <<"error creating myconnection"<<endl;exit(1);}
       myconnection->set_host("localhost");
       myconnection->set_user("root");
       myconnection->set_password("mypasswd");
       myconnection->connect();
    .
    .
    .

Prev |  | Next
Chapter 2. Get in contact with a table | Home | Chapter 4. Show data of a column