SQL connection works in normal Java but not Android - java

The title kind of says the most of it but I want to connect to SQL using my Android app that I have in development so I made a sample set of code just to test the concept without using android and it worked. When I tried to use it on Android it doesn't work (connection error) is there a permission I need to request in my manifest? Any help is greatly appreciated.

You can not establish JDBC connections to remote database in android either you should use SQLite DB on device or write socket based interface between your device and hosted machine or the most appropriate way of doing this is using REST webservices.

Related

How to create a public database in Android Studio to have connection between different apps?

I have an Android app that needs to retrieve info from a server that isn't related to the app.
I'll try to be more clear:
There's a server that is being updated every once in a while, and I need the devices to retrieve data from that server. How can I achieve this?
I thought about SQLite but I don't seem to understand how it will connect to an external database that isn't on the device

Saving data from android app to remote server

I am just a beginner in android app development and that's why I have many doubts. I am building one application where the user enters some data in editText. Now I want to save that data in my database. My database is running on my laptop. How would my app connect to the database? Do I need a web server in between? If yes then which web server is used for Android apps? Basically, i want to know the flow of data from app to the database.
Study more from Udacity.com, its free.
You may use a jdbc Connector to connect to database.
Connect your jdbc connector over local network ip\servername and database connection string
You can use REST Service when it comes to web Service on Android like this. You can either pass the values as parameters or an Object depending on your requirement. All the best
Wamp server is best option to play with server related utilities.You can use it even if you are offline. and it provides various option for data storage. It Mainly uses MySql and PHP scripts for fast performance.
For More details Click Here

Is it possible to connect an Android application to MySQL database, without Async tasks?

I'm learning Android development and mostly to retrieve data from the server side databases,I use Async tasks, to obtain data from PHP and MySQL.
I want to know whether is it possible to connect the android application directly to the MySQL database.What would be the adverse effects of doing so? And is there any example on how to perform CRUD operations using such direct MySQL connection?
According to: https://developer.android.com/reference/android/os/NetworkOnMainThreadException.html
you can't networking in main thread and according to:
Can an Android App connect directly to an online mysql database
Connecting to MySQL from Android with JDBC
Direct connection to MySQL in Android is not recommend/not possible.
If you anytime feel like using different Networking Calls. Use Volley, it is fast and better than Asynctask request. As per your question network calls are not possible on Main UI.
Try reading more about Volley which google introduced in 2013. A very good MySQL CRUD example on my blog. here

Android connectivity with sql database

I'm new to android technology. Can anyone, please, suggest me some proven idea to connect an android application from my laptop to a remote sql database server (without using php). I got connected from my java file to the database. But the output is displayed in the console part. How to get it displayed on the android screen?
For using webservies in Android you will require Ksoap Library.

Connect Android App on a PC-based database

I'm creating an Android App that would have to access a database on my PC. I know how to program in Java and access a MySQL on my PC using JDBC ODBC. Could anyone lead me to the right place?
android don't support jdbc.
why don't you make a application-server?
the architecture is this.
Android <<--(using REST/JSON)-->>Application-Server(including JDBC or ODBC) <<-->> Database
using json or rest is good to reduce data traffic.
and generally the application server is faster than Android device.

Categories