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
Related
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
I'm currently working on a project in which:
the client connects to a database server (mysql for example) through sockets
once connected, the user queries the database and receives data back from the server using sockets
Sockets will serve as a driver to pass data from the server to the client.
I tried looking online but could not find any hint/solution
I would appreciate some help and guidance
I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17
You could set up a third server dedicated to mySQL and share that database with the 2 web servers, or you can just run a mySQL database on each of those computers and use the IP address or domain name of them to connect to each other's server
Explanation:
You currently have a java website running and a php website running on one machine if i understand correctly.
What you need to do is download mySQL, and go through the tutorial to get the server up and running https://dev.mysql.com/doc/mysql-getting-started/en/
Then you need to download the mysql Java driver, and the mysql PHP driver
Then you need to use the drivers to connect to the same mySQL server from the code, which would be on localhost if you are doing it all on one machine.
MySQL is a server. It is its own thing, not a database like SQLite that you create in the java code or php code. You create and set it up separately as it's own server, and then any other server can connect to it
You can open and close a mysql connection any time.
mysql_connect(server, username, password);
Do some stuff with one database, then you can use:
mysql_close();
mysql_connect(server2, username2, password2);
as many times as you like.
Or you can use resource links:
$db1 = mysql_connect(server1, user1, passwd1);
$db2 = mysql_connect(server2, user2, passwd2);
But in this case, each mysql command needs to be referenced with the resource link:
mysql_query(query, $db1);
I have created a standalone application as a school project. The major problem we are encountering is that since it has Java as front-end and MySQL as back-end (compulsory), and we have created a database that solely belongs to one computer, we cannot run the same project on different machines because it won't have the required database, the tables, or the same username and password we used to connect to MySQL.
So my question is **How can I connect to MySQL server in different Machines? **
For database and Tables, I could run a sql file, but that will happen when I would be connected to the MySQL server. Also I am developing the project at my home computer, and I want to run the project on different computers who are connected to my computer by no means .
You a following options
Shared drive : Attach database stored on remote shared drive to a local SQL Server read here
Connect to remote SQL Server instance from local computer - better if they are in same LAN - Steps here
If you want to package DB with app where you have predefined data and you dont want to save transactional data - use inMemory DB. They will load when you application starts up.
Already your application can work using different machine.
You have only to change the localhost string in your connection string with the IP of the MySQL machine :
DriverManager.getConnection("jdbc:mysql://localhost/database?"+ "user=sqluser&password=sqluserpw");
And make sure that remote access are enabled in your MySQL configuration. You can find more about it here.
Instead of using localhost in your database connection string, you should use the ip or aname of the database host
e.g.
jdbc:mysql://IP:3306/db?user=user&password=password
jdbc:mysql://A-NAME/db?user=user&password=password
Just make sure that port 3306 is open and that you have access on the system the databasse is hosted on
I am attempting to create a MySQL DB and Java client app for my home network. I haven't really had any experience with MySQL other than PHPMyAdmin for a website backend (also have used SQLite). I have downloaded the full MySQL installation and a test DB from the MySQL website. On the server machine I successfully connected to the DB as root. Not a difficult task.
Now I want to connect to the DB from my client PC, just to check I can. Eventually I will use the JDBC driver to connect from my Java client app, but before that I just want to check I can connect.
How should I do this? SHould I just install the MySQL command line program onto the client PC?
EXTRA INFO: forgot to add, I'm using Windows 7 on all my machines.
Yes, you could install the MySQL to get MySQL command line program and connect with it, but also you can use another MySQL client tool like PHPMyAdmin, dbForge Studio for MySQL or another one.
To connect from remote host you should create special accout for it, e.g. - 'user_name'#'your_host_name'. Find more information here -
Specifying Account Names
Account Names and Passwords