A
A
Anna2017-03-05 18:12:10
linux
Anna, 2017-03-05 18:12:10

Java rest service - how to connect to the database (linux server)?

Good afternoon! Today I encountered such a problem: the server cannot connect to the mysql database.
I use VPS under Ubuntu. I installed mysql, added a database through the phpmyadmin panel.
The server was assembled in jar, launched on the machine. The server is running but not connecting to the database.
The settings that worked on the home computer were specified in persistence.xml, the
jdbc:mysql://localhost:1433/databaseName
username and password were changed to the appropriate ones. I tried to change localhost to server ip, port to 3306.
Maybe you need to grant some other rights?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Axian Ltd., 2017-03-05
@AxianLTD

Didn't specify what server. However, if it worked at home, but not on hosting, then there are no mysql drivers. Either put it in the right place for your server, or specify in the settings where it is located.

D
Dmitry, 2017-03-05
@dsv

It is necessary to somehow divide the task of finding a problem into several and check the components.
1. What does "the server cannot connect to the database" mean? And at the same time it works. Writes something to the log?
2. Is the database server available on the specified port? telnet localhost 1433 If not available, then we are looking for different options, such as that the server is not running at all or that it is waiting for a connection on a different port.
3. If step 2 is allowed, we connect to the database using command line utilities, check that the specified database exists, that the user exists and the correct password is used.
4. etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question