Updated the LoginExample

This commit is contained in:
mathias 2021-08-27 14:14:51 +02:00
parent e96bb22814
commit 86f3ce2f3e
No known key found for this signature in database
GPG Key ID: 8950DF62139C852A

View File

@ -1,7 +1,4 @@
import de.gnmyt.sqltoolkit.drivers.MySQLConnection;
import de.gnmyt.sqltoolkit.types.LoginParam;
import java.util.Arrays;
public class LoginExample {
@ -14,19 +11,16 @@ public class LoginExample {
String database = "database";
// Then we need to create a connection
MySQLConnection connection = new MySQLConnection(hostname, username, password, database, // Here you need to provide your mysql server data
LoginParam.AUTO_RECONNECT); // You can set login parameters in the constructor
MySQLConnection connection = new MySQLConnection(hostname, username, password, database); // Here you need to provide your mysql server data
// You can now set the settings of the connection (before connecting)
connection.updateSettings()
.useSSL(true) // You can set for example the ssl property
.customProperty("example", ""); // You can also set a custom property
// You can also set the connection string manually (before connecting)
connection.updateConnectionString(LoginParam.AUTO_RECONNECT,
LoginParam.USE_SSL,
LoginParam.UTF8_ENCODING);
// Now you can connect to the database
connection.connect();
// If you want to you can list all login parameters
Arrays.stream(LoginParam.values()).forEach(System.out::println);
}
}