elvis
elvis

Reputation: 1168

Why SSL is false when you open JDBC connection to MySQL?

I'm learning about JDBC and I don't understand something.

I know that the code to open the connection is:

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database?autoReconnect=true&useSSL=false", "root", "password");

And I have 2 question:

  1. What exactly is SSL and why SSL is false?
  2. What exactly is the autoReconnect?

Thanks in advance!

Upvotes: 2

Views: 4772

Answers (1)

marekmuratow
marekmuratow

Reputation: 404

  1. SSL is a cryptographic protocol which can encrypt all data communicated between the JDBC driver and the server. To use SSL you have to set it up first link. The useSSL attribute: default is 'true' when connecting to MySQL 5.5.45+, 5.6.26+ or 5.7.6+, otherwise default is 'false'

  2. The MySQL client library can perform an automatic reconnection to the server if it finds that the connection is down when you attempt to send a statement to the server to be executed. If auto-reconnect is enabled, the library tries once to reconnect to the server and send the statement again.

Upvotes: 1

Related Questions