1樓:匿名使用者
使用mysql開發包,在mysql安裝目錄裡面有一個include目錄。裡面包含了需要的c++標頭檔案
主要包含
#include
#include //根據自己目錄設定mysql標頭檔案
mysql mysql;
std::string db_host = "127.0.0.1";//mysql伺服器地址
std::string db_user = "root";//使用者名稱
std::string db_pwd = "rootpwd";//密碼
std::string db_name = "test_db";//訪問資料庫名
mysql_init(&mysql);//初始化mysql物件
c_str(), db_pwd.c_str(), db_name.c_str(), 3306, null, 0))//連線mysql伺服器
設定中文字符集
db_host就是mysql伺服器ip地址,字串,c++連線mysql伺服器其實不分本地或者遠端的,的都是按照連線伺服器來的,本地伺服器的就是127.0.0.1
具體開發的手冊,參考mysql官方開發文件
2樓:匿名使用者
使用sqlapi吧,這是個第三方庫,網上有使用方法的。你去找一下吧,不然要自己寫好多東西的。
如何配置mysql連線mysql資料庫
c ducuments and settings administrator cd 回車鍵 出現下面 c 第二步 c cd c program files mysql mysql server 5.0 bin 回車鍵 出現 c program files mysql mysql server 5.0...
java連線mysql資料庫如何獲取所有的資料庫名
select schema name from information schema.schemata 這樣就能取到所有的資料庫名 pstm conn.preparestatement sql resultset rs pstm.executequery arr new arraylist whil...
用jsp連線mysql資料庫,出現中文亂碼,該怎麼解決啊
你的表單提交到的頁面裡要轉碼。假如是在jsp頁面裡或servlet裡接收表單的資料,你要寫2行 request.setcharacterencoding utf 8 response.setcontenttype text html charset utf 8 我用的是utf 8,你用什麼編碼就寫什...