The
Ultimate
Business Machine

Technology, business
and innovation.

And, not least, about
the Mac.

Weblog Archive Cutedge

by: Bernard Teo








Creative Commons License

Copyright © 2003-2012
Bernard Teo
Some Rights Reserved.

Wed 20 Apr 2016

MySQL Connector – Or how to build libmysqlclient with just one click

Category : Database/libmysqlclient_intro.txt

I’ve created a project that could build libmysqlclient (for macosx, iphoneos, and iphonesimulator), with just one click.

libmysqlclient is a small client-side software, that will allow a Mac or iOS device to connect to a remote MySQL database. Once you have the ability to make such a connection, you could build complete database-driven apps that will store/retrieve data from the remote database, as though the database sits right inside your device. This really is magic. You could do lots of useful stuff with it.

I’ve had a hard time figuring out how to build the libmysqlclient, especially for iOS and iphonesimulator, ever since MySQL decided to use cmake for their builds. But I had to persevere, because a lot of my apps depend on this crucial piece of "plumbing”.

I’ve seen a lot of people looking to do the same thing. So, here’s the way to do it. You could download the folder that contains the project here. It’s called BuildMySQLClient (download by clicking on that link).

Once downloaded, you should see two folders:
The "Building libmysqlclient” folder contains the Xcode project that actually builds the libmysqlclient. Hit Build (Command-B) and the project will build the required libs and include folders for all three variations (for macosx, iphoneos, and iphonesimulator). Once the build is complete, you can find them inside the user’s ~/Library/SDKs folder, which the project will create.

The “TestMySQLConnection” folder contains another Xcode project that will allow you to test that the connection works, while showing you how to use the lib and include folder inside your own project. Again, it shows all three variations (for macosx, iphoneos, and iphonesimulator).

The example project shows just the rudiments of connecting programmatically to a MySQL server from a Mac or iOS device, using a C programming interface. The complete language guide can be found at the MySQL C API site.

To help you get everything you need, at one go, to test/learn about using a MySQL database programmtically, I have a MySQL 5.7.x database installer you can download.

And you can use my other app, Liya, on the Mac, to very quickly set up a “test” database that the example code, above, uses. It just requires that you have a table called “Table1” with any number of string/character fields, and you can enter any number of records, like I’ve shown below:

setUpTheTestDatabase.png
On the Mac, you can set all this up very easily. Install and run the MySQL database on the same development Mac. You can connect to this database simply, using Liya, via the localhost connection, using the account root without password, and look for the database test. Set up the test database, as shown. Install libmysqlclient. Use the latest Xcode (Version 7.3). Build for the latest Mac OS X (10.11) and iOS and simulator (9.3). And then run the example code to test the connection. And you can build from there.

That’s all there is to it.

As usual, this is all fun to do, but this is provided without guarantee and without offer of support. Please don’t write in to get me to hand-hold you every step of the way. I’ve spent countless hours figuring this out. You could at least put in a bit more effort. But I would love to hear how, and if, this has helped you, and if you have better ideas on how we could improve the process. Thanks.

And, Enjoy!

Posted at 6:57AM UTC | permalink

DNS Enabler 9.0.4

Category : Technology/DNSEnabler9dot0dot4.txt

Released a new version of DNS Enabler 9.0.4 today, which includes a new binary of BIND 9.10.3.

You can download it from the DNS Enabler for El Capitan page.

Posted at 2:17AM UTC | permalink

Mac@Work
Put your Mac to Work

Sivasothi.com? Now how would you do something like that?

Weblogs. Download and start a weblog of your own.

A Mac Business Toolbox
A survey of the possibilities

A Business Scenario
How we could use Macs in businesses

VPN Enabler for Mavericks

MailServe for Mavericks

DNS Enabler for Mavericks

DNS Agent for Mavericks

WebMon for Mavericks

Luca for Mavericks

Liya for Mountain Lion & Mavericks

Postfix Enabler for Tiger and Panther

Sendmail Enabler for Jaguar

Services running on this server, a Mac Mini running Mac OS X 10.9.2 Mavericks:

  • Apache 2 Web Server
  • Postfix Mail Server
  • Dovecot IMAP Server
  • Fetchmail
  • SpamBayes Spam Filter
  • Procmail
  • BIND DNS Server
  • DNS Agent
  • WebDAV Server
  • VPN Server
  • PHP-based weblog
  • MySQL database
  • PostgreSQL database

all set up using MailServe, WebMon, DNS Enabler, DNS Agent, VPN Enabler, Liya and our SQL installers, all on Mavericks.