Android - PHP - Microsoft SQL Server
As I promised before, now I would like to share how to create Android applications that connect to Microsoft SQL Server database, using PHP Web Service. And one more thing I want to teach you about how to make Android application WITHOUT using the JAVA programming language. Okay, the tools we will use this time are:
1. Basic 4 Android, you can download it here.
2. XAMPP as a web server, you can download it here.
3. Microsoft SQL Server 2000, 2005 Express, 2005, 2008 or later, you can download it here.
4. Microsoft Drivers for PHP for SQL Server, you can download it here.
5. Android SDK which you can download here and Java JDK here.
First you must install the Basic 4 Android, and of course you have to buy licenses to use the library functions in it.
Then install XAMPP, need to be considered for connection to Microsoft SQL Server 2000 I recommend to use the old version for example XAMPP version 1.6.8. If you use Microsoft SQL Server 2005 and above, I recommend to install the latest version of XAMPP and also install the SQL Server Driver for PHP which you can download here. This is because the new version of XAMPP is not included drivers for connection from PHP to Microsoft SQL Server.
I will not go into too much detail for the setting on the Basic 4 Android, then XAMPP, I assume that you can, because if I was too detailed to discuss this article becoming too long. I hope you can understand, if you have any questions , you can email me at: firstname.lastname@example.org or through comments on this blog.
First time we will make the user interface in the Basic 4 Android, by first running the Android SDK - AVD manager.
Then connect the menu Designer at Basic 4 Android to AVD manager.
Then create a login view, user text box, password text box, then the Login button, then save by name Login_Form, as shown below
Then we move to make the code in Basic 4 Android, the language used is Basic, or Visual Basic Like. First put all the variables in Sub Globals, as shown below
Then the procedure Activity_Create type the code shown below, the function of this code is to load Login_Form. And do not forget to checked the necessary library ,library http and json library.
Then create a procedure to capture input on user text box , create a procedure and code like in the picture below
For complete syntax querp.php you can see here and you have to replace mysql_connect to mssql_connect (because we used Microsoft SQL Server not MySQL as database server), if you use XAMPP is necessary to note problems like this.
Then at procedure hc_responseSuccess, type the code as shown below:
When finished,try to run the program in Basic 4 Android, for the initial setting Basic 4 Android, you can see the tutorial here
Then try the user name previously already exists in Microsoft SQL Server database, and then press enter, if successful it will appear as below:
How to connect Java to MySQL
How to connect Java to SQL Server
Ubuntu-PHP-Apache-FreeTDS-MS SQL Server
How Fast JSON on Android?