If you want to connect MS SQL server database with android studio this is your right choice. This tutorial teach you how to connect android studio with MS SQL Database easily. We usually use desktop application and need to see summary result in android application. In that case it’s very important to extract live data from SQL server database to android app.
To perform this task we need to connect MS SQL server with android studio. To practice this tutorial you should have installed java, android studio and SQL server.

Steps are
1. Create and design android app
2. Create MS SQL server database table and insert records.
3. Add java class to connect MS SQL with android studio.
4. Write code in MainActivity. java to display result.
5. Add Jar Dependency in your project library.
6. Add permission in AndroidManifest xml file.
7. Run the app.

Note:
You must have enabled TCP IP in SQL Server if TCP IP is being disabled then restart SQL Server Service.
To download .jtds file go to this link
https://drive.google.com/file/d/1GKf8KNx6dxHGtxfnlyba9vXApLX-Qrgs/view?usp=sharing

download and install android studio JDK and SDK

Connection con;

@SuppressLint(“NewApi”)
public Connection conclass() {
String ip = “172.1.2.2”, port = “1433”, db = “mytestdb”, username = “sa”, password = “yourpass”;
StrictMode.ThreadPolicy a = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(a);
String connectURL = null;

try {
Class.forName(“net.sourceforge.jtds.jdbc.Driver”);
connectURL = “jdbc:jtds:sqlserver://” + ip + “:” + port + “;databasename=” + db + “;user=” + username + “;”+”password=” + password + “;”;
con = DriverManager.getConnection(connectURL);
} catch (Exception e) {
Log.e(“Error :”, e.getMessage());
}
return con;
}

——
This channel covers all the programming tutorial related with .Net- C#, linq, VB, SQL, Android, HTML, CSS, jQuery, Crystal Report and Microsoft Report.
So, Please subscribe and keep in touch.
https://www.youtube.com/c/ProgrammingGeek

Visit my page in Facebook
https://www.facebook.com/programminggeek7
——

More Tags
#ConnectMSSQLServerwithAndroidStudio #ConnectAndroidStudiowithSQLServerDatabase #SQLToAndroidStudio

programminggeek,connect android studio with sql server,how to connect android studio with sql server database,connect android studio to database,connect sql database to android studio,connect sql to android studio,connect android studio to sql server,how to connect sql to android studio,connect ms sql server with android studio

By admin

14 thoughts on “How to Connect Android Studio With MS SQL Server Step By Step | ProgrammingGeek”

Leave a Reply

Your email address will not be published.