Updated the LoginExample
This commit is contained in:
parent
e96bb22814
commit
86f3ce2f3e
@ -1,7 +1,4 @@
|
|||||||
import de.gnmyt.sqltoolkit.drivers.MySQLConnection;
|
import de.gnmyt.sqltoolkit.drivers.MySQLConnection;
|
||||||
import de.gnmyt.sqltoolkit.types.LoginParam;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class LoginExample {
|
public class LoginExample {
|
||||||
|
|
||||||
@ -14,19 +11,16 @@ public class LoginExample {
|
|||||||
String database = "database";
|
String database = "database";
|
||||||
|
|
||||||
// Then we need to create a connection
|
// Then we need to create a connection
|
||||||
MySQLConnection connection = new MySQLConnection(hostname, username, password, database, // Here you need to provide your mysql server data
|
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
|
|
||||||
|
// 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
|
// Now you can connect to the database
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
|
||||||
// If you want to you can list all login parameters
|
|
||||||
Arrays.stream(LoginParam.values()).forEach(System.out::println);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user