Latest news and developments from Devso, including progress updates on the development of Crash Catch (https://crashcatch.com) and future projects
Chris BoardJun 1, 2018 • 6 min read
We are execited to announce we have developed a new MySQL connector library to allow you to connect directly to your MySQL databases directly if required from your Android apps. This is available as an open source project on GitHub. Before we get into the nitty gritty of the library lets start with why we developed and best practices for Android and MySQL.
We've been doing Android Development for about 10 years, with one of our apps being a MySQL Database Management App. Android, until now, had no native MySQL connection and had to rely on some sort of web service in order to connect to the database.
Originally this is what we did, we developed a PHP API to allow you to connect to the database. This worked by the Android app, sending a JSON request which contained your connection details to your database. The PHP API would receive the request, connect to your database, and execute the query on the database, get the response back from your database, build a JSON object which Android then receives and processes to display you the result.
This worked fine except it had a couple of issues and gotchas related to doing it this way.
It was our database server connecting to your database, although all data sent between the device and our server was encrypted, and we, at no point did we store the connection details are process what data was returned from the DB, but obviously for some people this was still a concern for people.
To get around this potential concern, we made the PHP API web service available as an open source project on GitHub that you could install on your own web server and tell the app the to use your installed version instead of the Boardies IT Solutions servers
Local Database Access
Due to the API by default running on the Boardies IT Solutions server, your database had to be available over the internet from our server, therefore you weren't able to connect to a database on your local home or office network. There work arounds for this, such as port forwarding to allow connections from outside on the Internet into your local network, or installing the PHP API on your own network and then telling the app to use that, although was inconvineant and depending on what was used, could be tricky to implement.
During our Android Development we spend a fair amount of time looking on Stackoverflow, either to get help ourselves, or at times provide answers to questions on the site. For years we keep seeing the odd question about connecting to a MySQL database through Android and every response is connecting directly is bad practice and a web service should be used, many sites and development blogs also state this, and even though we have developed a native MySQL Connector for Android this is still the case.
If you have a requirement for connecting to a MySQL database from your android app, you should be using a web service, this adds extra security to your database as it doesn't expose it publicly to the Internet and you have control as to what is being done on the database through your API. However, there are times when you might need, or want, to connect to your database directly. This is where our Android MySQL Connector comes in.
We developed our native Android MySQL Connector for our MySQL Manager android app. We wanted to remove the limitations of the app, and some of the bad reviews the app gets as some users haven't read the description and followed the instructions to understand the limitations of the PHP API, and of course, we want to make the app, the best that it can be. Therefore, we first developed the MySQL connector, and now we are using it to rebuild our MySQL Management app from the ground app to work with the new connector.
We are still in the early stages of the MySQL Manager app rewrite but during our early stages, connecting to the database is a lot faster, as there's no middleware processing between the Android app and the PHP API, and is instead connecting directly and getting the response directly.
We've tested the MySQL connector on MySQL 5.1 through to MySQL 5.7. It will still need a fair amount of testing to ensure that it works with various configurations that can be used with MySQL. This is where you come in. We'd love if you signed up to the Beta version of our MySQL Manager android app to try th new version and provide us feedback on how the app runs, and any issues that you may experience with connecting to your own database server.
There are few limitations of the app while we're still in development, but below is the current functionality that is working:
For any developers out their reading this, we'd also really like it if you checked out our respository for the Android MySQL Connector and try using it in your own apps, and of course we really like it to have other developers contribute to the project.
The Android MySQL Connector is still quite new in development and is fairly basic compared to the official versions of the connector provided by Oracle for other platforms, therefore it has some limitations. The limiation of the connector are described below:
You can find more information about the library by visiting the Github Repository.
Are you a developer, you might be interested in Crash Catch.
A simple and affordable crash and error reporting service no matter your development stack.
Developed by Devso