JAVA connection to BANK

Asked

Viewed 240 times

4

I am not able to connect the java with database, because an error appears as in the image,

inserir a descrição da imagem aqui

Can someone help me?

  • Is the database server active? put the source code as text and not as image so other tbm people can help.

  • 1

    Put the code not a print of it, so it will be easier to test.

  • 3

    Have you configured your Mysql to use port 3307? I ask you, the default port is 3306. And what about the driver... Give preference to "com.mysql.jdbc.Driver". The driver you are using, although compatible, was used before the project (the driver, in case) was donated to Mysql.

  • Yes! , normal is 3306, I was testing 3307 and no works, I added the Netbeans drive itself the drive loads normal , the connection that is not made, I have installed the shaman novante and continues to msm thing!

  • Post the code, so you cover who uses screen reader.

1 answer

3

Only Wrapped Exception returned no help, the ideal would be to have all the stack trace and get the root cause.

However I will indicate some possibilities, which can help those who get a Communications Link Failure:

Initially find the Mysql settings file:

Linux = /etc/mysql/my.cnf

Windows = C: Minhalocalizacaodordbms mysql bin my.ini


- Correct door?

To 3306 is the default port of Mysql, you are using the 3307.

A netstat can help in the investigation:

  • win = C:>netstat -an | findstr 3306
  • linux = $ netstat -ln | grep 3306


- Loopback interface is ok?

Try changing the localhost to 127.0.0.1, If it works it’s worth taking a look at how your OS is solving the loopback.

linux = /etc/hosts

windows = C: Windows System32 drivers etc hosts file


- Configuration of Binding

Problems of Binding are common, try to clarify the configuration in the [mysqld] tab the default would be 0.0.0.0 and accept all ipv4 hosts:

bind-address    = 127.0.0.1 

or explain to all interfaces

bind-address    = 0.0.0.0


- Keep "Skip Networking" commented

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
# 
#skip-networking

Browser other questions tagged

You are not signed in. Login or sign up in order to post.