JAVA Connection with BANK

4

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

Can anyone help me?

    
asked by anonymous 15.06.2015 / 19:32

1 answer

3

Only wrapped exception returned does not help, ideally we would have the entire stack trace and get the root cause .

But I will point out some possibilities, which can help anyone who obtains a Communications Link Failure:

Initially find the MySQL configuration file:

  

Linux = /etc/mysql/my.cnf

     

Windows = C: \ MyRDBMSLocation \ mysql \ bin \ my.ini


- Correct port?

3306 is the default MySQL port, you are using 3307 .

A netstat can help with the research:

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


- Loopback interface ok?

Try changing the localhost to 127.0.0.1 , if it works it's worth taking a look at how your OS is resolving loopback .

  

linux = / etc / hosts

     C: \ Windows \ System32 \ drivers \ etc \ hosts file


 - Binding Configuration

Problems with binding are common, try to explicitly configuration on the [mysqld] tab the default would be 0.0.0.0 and would accept all ipv4 hosts:

bind-address    = 127.0.0.1 

or explicitly for 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
    
17.06.2015 / 05:12