{"id":26965797,"url":"https://github.com/jamesql/cplusplus-mysql-basic","last_synced_at":"2026-05-14T12:32:12.676Z","repository":{"id":148888019,"uuid":"207941474","full_name":"jamesql/CPlusPlus-MySQL-Basic","owner":"jamesql","description":"Basic Setup for MySQL For C++","archived":false,"fork":false,"pushed_at":"2019-09-12T02:07:39.000Z","size":12,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T01:47:19.298Z","etag":null,"topics":["basic","cpp","lib","library","mysql","setup","setup-cpp","setup-mysql","sql"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-12T01:48:53.000Z","updated_at":"2021-01-28T15:11:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"a30b1d85-25f6-4f26-ad54-7a60b6748b58","html_url":"https://github.com/jamesql/CPlusPlus-MySQL-Basic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jamesql/CPlusPlus-MySQL-Basic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesql%2FCPlusPlus-MySQL-Basic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesql%2FCPlusPlus-MySQL-Basic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesql%2FCPlusPlus-MySQL-Basic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesql%2FCPlusPlus-MySQL-Basic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesql","download_url":"https://codeload.github.com/jamesql/CPlusPlus-MySQL-Basic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesql%2FCPlusPlus-MySQL-Basic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33024933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["basic","cpp","lib","library","mysql","setup","setup-cpp","setup-mysql","sql"],"created_at":"2025-04-03T07:33:27.350Z","updated_at":"2026-05-14T12:32:12.658Z","avatar_url":"https://github.com/jamesql.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Basic C++ MySQL Setup\nBasic Setup for MySQL For C++\n# Where to get MySQL Connecter 8 for C++?\n- [Click Here!](https://dev.mysql.com/doc/connector-cpp/8.0/en/)\n# Connection String\n```cpp\n\"tcp://127.0.0.1:3306\", \"root\", \"Password\"\n```\n\n# Basic Includes\n```cpp\n#include \"jdbc/mysql_connection.h\"\n#include \u003cjdbc/cppconn/driver.h\u003e\n#include \u003cjdbc/cppconn/exception.h\u003e\n#include \u003cjdbc/cppconn/resultset.h\u003e\n#include \u003cjdbc/cppconn/statement.h\u003e\n```\n\n# Namespace\n```cpp\nusing namespace ::sql;\n```\n# Basic Objects\n```cpp\nDriver *driver;\nConnection *con;\nStatement *stmt;\nResultSet *res;\n```\n\n# Initilize Driver \u0026 Connect\n```cpp\ndriver = get_driver_instance();\n```\n```cpp\ncon = driver-\u003econnect(\"tcp://127.0.0.1:3306\", \"root\", \"password\");\n```\nIn a method :\n```cpp\nvoid connectDatabase() {\n    driver = get_driver_instance();\n    con = driver-\u003econnect(\"tcp://127.0.0.1:3306\", \"root\", \"password\");\n}\n\nvoid disconnectDb() {\n    con-\u003eclose();\n    delete con;\n}\n```\n\n# Query w/ Result Set\n```cpp\nResultSet* query(std::string statement) {\n    ResultSet *newRes;\n    stmt = con-\u003ecreateStatement();\n    newRes = stmt-\u003eexecuteQuery(statement);\n    return newRes;\n}\n```\n\n# Full Basic File\n```cpp\n#include \"jdbc/mysql_connection.h\"\n#include \u003cjdbc/cppconn/driver.h\u003e\n#include \u003cjdbc/cppconn/exception.h\u003e\n#include \u003cjdbc/cppconn/resultset.h\u003e\n#include \u003cjdbc/cppconn/statement.h\u003e\n\nusing namespace ::sql;\n\nDriver *driver;\nConnection *con;\nStatement *stmt;\nResultSet *res;\n\nvoid connectDatabase() {\n    driver = get_driver_instance();\n    con = driver-\u003econnect(\"tcp://127.0.0.1:3306\", \"root\", \"password\");\n}\n\nvoid disconnectDb() {\n    con-\u003eclose();\n    delete con;\n}\n\nvoid setSchema(std::string db) {\n    con-\u003esetSchema(db);\n}\n\nResultSet* query(std::string statement) {\n    ResultSet *newRes;\n    stmt = con-\u003ecreateStatement();\n    newRes = stmt-\u003eexecuteQuery(statement);\n    return newRes;\n}\n\nint main() {\n  connectDatabase();\n  setSchema(\"database\");\n  ResultSet *r = query(\"SELECT * FROM database\");\n  while(r-\u003enext()) {\n    cout \u003c\u003c res-\u003egetString(1) \u003c\u003c endl;\n  }\n  disconnectDb();\n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesql%2Fcplusplus-mysql-basic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesql%2Fcplusplus-mysql-basic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesql%2Fcplusplus-mysql-basic/lists"}