Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <iostream>
- #include "mysql_connection.h"
- #include <cppconn/driver.h>
- #include <cppconn/exception.h>
- #include <cppconn/prepared_statement.h>
- int main()
- {
- const std::string server = "xxxxxx";
- const std::string username = "xxxxx";
- const std::string password = "xxxxx";
- sql::Driver* driver;
- sql::Connection* connection;
- sql::Statement* statement;
- sql::ResultSet* resultSet;
- // Test connections
- try
- {
- driver = get_driver_instance();
- connection = driver->connect(server, username, password);
- std::cout << "connection was successful";
- }
- catch (sql::SQLException e)
- {
- std::cout << "Could not connect to server. Error message: " << e.what() << std::endl;
- system("pause");
- exit(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement