{"id":927,"date":"2008-08-08T04:31:40","date_gmt":"2008-08-08T09:31:40","guid":{"rendered":"http:\/\/www.bytebot.net\/blog\/?p=927"},"modified":"2008-08-08T04:31:40","modified_gmt":"2008-08-08T09:31:40","slug":"howto-mysql-connectorc-on-mac-os-x","status":"publish","type":"post","link":"https:\/\/www.bytebot.net\/blog\/archives\/2008\/08\/08\/howto-mysql-connectorc-on-mac-os-x","title":{"rendered":"HOWTO: MySQL Connector\/C++ on Mac OS X"},"content":{"rendered":"<p>Excited with the <a href=\"http:\/\/blog.ulf-wendel.de\/?p=185\">release<\/a> of the <a href=\"http:\/\/forge.mysql.com\/wiki\/Connector_C%2B%2B\">MySQL Connector\/C++<\/a>, I thought I&#8217;d get it going on Mac OS X.<\/p>\n<p>You&#8217;ll first hit the problem that Mac OS X doesn&#8217;t come with <a href=\"http:\/\/www.cmake.org\/HTML\/index.html\">CMake<\/a>. So you&#8217;ll have to download it from the site &#8211; there&#8217;s a warning there that the .dmg installer only works for Tiger, but I ran it on Leopard, and its just fine. Don&#8217;t forget to allow it to create links in \/usr\/bin for ease of use.<\/p>\n<p>After that, you will need to install <a href=\"http:\/\/www.gtk.org\/\">glib<\/a>. But to get glib going, you need some dependencies:<\/p>\n<ul>\n<li><a href=\"ftp:\/\/ftp.gnu.org\/pub\/gnu\/gettext\/\">gettext<\/a><\/li>\n<li><a href=\"http:\/\/pkgconfig.freedesktop.org\/wiki\/\">pkgconfig<\/a><\/li>\n<li>and then <a href=\"ftp:\/\/ftp.gtk.org\/pub\/glib\/\">glib<\/a><\/li>\n<\/ul>\n<p>Installing them is simple: untar (<tt>tar -zxvpf package.tar.gz<\/tt>), <tt>.\/configure<\/tt>, <tt>make<\/tt>, then a <tt>sudo make install<\/tt>.<\/p>\n<p>Now, the README file or the instructions on the wiki will just work. I have several MySQL installations, so I preferred to specify what cmake found. I did this by:<br \/>\n<code>cmake -D MYSQL_DIR:PATH=\/usr\/local\/mysql\/ -D GLIB_DIR:PATH=\/usr\/local\/lib\/glib-2.0\/ .<\/code><\/p>\n<p>Then a simple make, and you can go on and try the examples, in <tt>examples\/<\/tt>. Try the <tt>connect<\/tt> application to make sure things are working. You will probably run into a snag though:<\/p>\n<blockquote><p><code><br \/>\nluna:examples ccharles$ .\/connect<br \/>\nConnector\/C++ connect basic usage example..<\/code><\/p>\n<p><code>ERR: MySQL_DbcException in \/Users\/ccharles\/code\/mysql_connector_cpp_1_0_0_preview\/examples\/connect.cpp((function n\/a)) on line 159<br \/>\nERR: Cannot connect (MySQL error code: 0 )<\/code><\/p><\/blockquote>\n<p>Take a look at <tt>examples\/examples.h<\/tt>, and look at the connection properties. It uses the test database, on localhost (127.0.0.1), standard port 3306, user is root, and the <strong>default password set there is root<\/strong> too. This may not be the commonest setting, so don&#8217;t hesitate to change the password or leave it blank (ala a default install), and rerun make. The sample applications will now work :)<\/p>\n<p>Congratulations to Andrey, Ulf, and the rest of the connectors team in getting this going!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Excited with the release of the MySQL Connector\/C++, I thought I&#8217;d get it going on Mac OS X. You&#8217;ll first hit the problem that Mac OS X doesn&#8217;t come with CMake. So you&#8217;ll have to download it from the site &#8211; there&#8217;s a warning there that the .dmg installer only works for Tiger, but I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[23],"tags":[46,389,390,1775],"class_list":["post-927","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-c","tag-connectorc","tag-connectors","tag-mysql"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p4vJD-eX","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"amp_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/comments?post=927"}],"version-history":[{"count":1,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/927\/revisions"}],"predecessor-version":[{"id":928,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/927\/revisions\/928"}],"wp:attachment":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/media?parent=927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/categories?post=927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/tags?post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}