The hk_classes programmer's tutorial
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

       1 #include <hk_classes.h>
       2 #include <iostream>
       3 int main()
       4 {
       5    hk_drivermanager* mydrivermanager = new hk_drivermanager();
       6    if (mydrivermanager==NULL) {cout <<"error creating mydrivermanager"<<endl;exit(1);}
       7    hk_connection* myconnection = mydrivermanager->new_connection("mysql");
       8    if (myconnection==NULL) {cout <<"error creating myconnection"<<endl;exit(1);}
       9    myconnection->set_host("localhost");
      10    myconnection->set_user("root");
      11    myconnection->set_password("mypasswd");
      12    myconnection->connect();
      13 .
      14 .
      15 .

Prev | Home | Next
Get in contact with a table |  | Show data of a column