Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <mysql/mysql.h>
- using namespace std;
- int main()
- {
- char *host = "localhost";
- char *user = "root";
- char *pass = "pass";
- char *db = "database";
- MYSQL *sock;
- sock = mysql_init(0);
- if (sock) cout << "Wena Sock Handle!" << endl;
- else {
- cout << "Pal Pico la Sock Handle!" << mysql_error(sock) << endl;
- }
- if (mysql_real_connect(sock,host,user,pass,db,3306,"mysql",0))
- cout << "connection Wena!" << endl;
- else {
- cout << "Connection Pal Pico!: " << mysql_error(sock) << endl;
- }
- cout << "connection character set: " << mysql_character_set_name(sock) << endl;
- system("PAUSE");
- mysql_close(sock);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement