Connecting my Android App to a database - java

I am new to Android and am trying to create an App which can connect to a database.
Web Server = Apache Tomcat
Database = MySQL
Web Service = HTTP Requests and Servlets?
I have never used PHP before, is there a way that I can connect to the database using only Servlets?
Also, would I need a JDBC Driver and SQL Server?

yes you need JDBC driver to connect to mysql DB on your servlet side, but if you're using MySQL, why you need SQL server for?? you can take a look at this blog post on how to send request from your android app to servlet.

Related

How to create mySQL database from android application

i have an android application that connects to a server to send data to mysql database, i need a way to create that same database but in another server. Is there a way that i can create the database in the server from my android application? so i dont need to interact directly with the server mysel. I part from the suppose that the other server already has mysql installed

JDBC Connection url to AWS

I have a running instance in AWS and a derby database in /home/ubuntu/mydata . Is it possible to connect to that database from my desktop application if I write my jdbc url like like this : jdbc:derby://<aws_ip_address>:1527/home/ubuntu/mydata;create=true ? Basically this works in local area network fine. I am using c3p0 for connection pulling. If it is not possible, how should I connect the the database?
Edit: I've also added the security group in AWS

I can't get Android app to connect to XAMPP Localhost

I've tried and searched the internet.I am very new to this so....
Does anyone know how to connect an Android app to a MySQL Database WITHOUT PHP?
I am using a PrintWriter and flushing two strings to a XAMPP Server Database,
I personally don't like using PHP err (referenced variables that don't even exist)
Basically I just have an app that sends login data to Server Database but I want to test it
any help appreciated!
QuestionOverflow
I see here misconception Of what the PHP is and what MySQL Database for and the real question is "Is it possible to connect to MySQL database from android app?"
And the answer is NO. but why ...
We have android app which run on Mobile Device --> (client)
And server which runs MySQL Database Server --> (server)
The problem here is that the MySQL database server doesn't show it self to public to all clients.
Only programs that runs on the server can connect to the MySQL Database.
But how to save and get the data from my database ??!!
You should need a http end point like PHP that will be available to the clients and will connect to the MySQL Database and get the data and return them to the client (mobile app).
And if don't like PHP if you master it you will like it check this tutorial
enter link description here

How to connect Java desktop application to an online mysql database?

As titled, I want to make my desktop java application to connect to an online mysql db ?! How can I reach it such connection to be able to add and retrieve data?!
Download the connector from here. Add it to your classpath and in the code:
// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
connect = DriverManager
.getConnection("jdbc:mysql://remoteUri/database-name?"
+ "user=user&password=userpw");
By all means, a JDBC connection is the way to go. But, you must make sure that the MySQL users have access to the database from another IP Address (i.e. your desktop application).
MySQL users are set up so that they can access the database on the local machine. Therefore, you have to allow access to the MySQL database from any host. Please see the following article which shows how to do that.
You could directly connect and let the queries run over the network (via JDBC)example: vogella.com
You build an RESTful Service, there are lots of tutorials as Example;
RESTful Web Services API using Java and MySQL

do i need a tomcat server to make java jdbc swing application to run on lan

I am attempting to create a MySQL and Java client app for my home network.On the server machine I successfully connected to the MySQL as root
Now I want to connect to MySQL from my client PC using the Java client program,
How to do this??
Do i need to install Tomcat Server to run on server for this.
I am using Windows 7 on all my clients and server machines.
Tomcat server is used for web applications.You just need to create a JDBC code and in the URL string just give the ip address of the system where mysql is installed.For example
connection = DriverManager
.getConnection("jdbc:mysql://192.168.1.205:3306/database_name","root", "password");
Also if you have not granted the permission in mysql then grant it .See this for granting permission for access to mysql on remote system
Depending on what you want to achieve, you need to establish a JDBC connection to the server. Take a look at the JDBC trail for more details.
This will allow you to connect directly from you client machine to your database server. This would be done using the required JDBC connection URL for the MySQL connection, for example jdbc:mysql://[host][,failoverhost...][:port]/[database] ยป
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]..., check out Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for more details.
You may also need to configure your MySQL server to allow remote access before you can connect
You just need to do two things:
Make sure the server hosting MySQL allows incoming connections
Write JDBC code and use your MySQL server hostname/ipaddress in the jdbc string to connect and use it.

Categories

Resources