File tree 12 files changed +23
-23
lines changed
src/main/java/com/example
src/main/java/com/example
src/main/java/com/example
12 files changed +23
-23
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,12 @@ Change `Service` constructor to use a `MariaDbPoolDataSource` and run the app ag
23
23
Prepare the database:
24
24
25
25
``` sql
26
- CREATE DATABASE jdbc_demo ;
26
+ CREATE DATABASE demo ;
27
27
CREATE USER 'user '@' %' ;
28
- GRANT ALL ON jdbc_demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
28
+ GRANT ALL ON demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
29
29
FLUSH PRIVILEGES;
30
30
31
- USE jdbc_demo ;
31
+ USE demo ;
32
32
CREATE TABLE programming_language (
33
33
name VARCHAR (50 ) NOT NULL UNIQUE,
34
34
rating INT
Original file line number Diff line number Diff line change 15
15
<dependency >
16
16
<groupId >org.mariadb.jdbc</groupId >
17
17
<artifactId >mariadb-java-client</artifactId >
18
- <version >2.7.4 </version >
18
+ <version >3.1.2 </version >
19
19
</dependency >
20
20
</dependencies >
21
21
Original file line number Diff line number Diff line change @@ -41,15 +41,15 @@ private Service() throws SQLException {
41
41
* MariaDbPoolDataSource dataSource = new MariaDbPoolDataSource();
42
42
* That should work!
43
43
*/
44
- dataSource .setUrl ("jdbc:mariadb://localhost:3306/jdbc_demo " );
44
+ dataSource .setUrl ("jdbc:mariadb://localhost:3306/demo " );
45
45
dataSource .setUser ("user" );
46
46
dataSource .setPassword ("password" );
47
47
this .dataSource = dataSource ;
48
48
/*
49
49
* If you are using MariaDB SkySQL (https://mariadb.com/products/skysql),
50
50
* enable SSL and specify the path to the CA chain file that you can download
51
51
* from the SkySQL Portal (https://cloud.mariadb.com):
52
- * jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/jdbc_demo ?useSsl=true&
52
+ * jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/demo ?useSsl=true&
53
53
* serverSslCert=/path/to/your/skysql_chain.pem
54
54
*/
55
55
}
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ connection.close();
51
51
Prepare the database:
52
52
53
53
``` sql
54
- CREATE DATABASE jdbc_demo ;
54
+ CREATE DATABASE demo ;
55
55
CREATE USER 'user '@' %' ;
56
- GRANT ALL ON jdbc_demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
56
+ GRANT ALL ON demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
57
57
FLUSH PRIVILEGES;
58
58
```
59
59
Original file line number Diff line number Diff line change 19
19
<dependency >
20
20
<groupId >org.mariadb.jdbc</groupId >
21
21
<artifactId >mariadb-java-client</artifactId >
22
- <version >2.7.4 </version >
22
+ <version >3.1.2 </version >
23
23
</dependency >
24
24
</dependencies >
25
25
Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ public static void main(String[] args) throws SQLException {
28
28
private static void initDatabaseConnection () throws SQLException {
29
29
System .out .println ("Connecting to the database..." );
30
30
connection = DriverManager .getConnection (
31
- "jdbc:mariadb://localhost:3306/jdbc_demo " ,
31
+ "jdbc:mariadb://localhost:3306/demo " ,
32
32
"user" , "password" );
33
33
System .out .println ("Connection valid: " + connection .isValid (5 ));
34
34
/*
35
35
If you are using MariaDB SkySQL (https://mariadb.com/products/skysql),
36
36
enable SSL and specify the path to the CA chain file that you can download
37
37
from the SkySQL Portal (https://cloud.mariadb.com):
38
- jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/jdbc_demo ?useSsl=true&serverSslCert=/path/to/your/skysql_chain.pem
38
+ jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/demo ?useSsl=true&serverSslCert=/path/to/your/skysql_chain.pem
39
39
*/
40
40
}
41
41
Original file line number Diff line number Diff line change @@ -49,12 +49,12 @@ try (PreparedStatement statement = connection.prepareStatement("""
49
49
Prepare the database:
50
50
51
51
``` sql
52
- CREATE DATABASE jdbc_demo ;
52
+ CREATE DATABASE demo ;
53
53
CREATE USER 'user '@' %' ;
54
- GRANT ALL ON jdbc_demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
54
+ GRANT ALL ON demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
55
55
FLUSH PRIVILEGES;
56
56
57
- USE jdbc_demo ;
57
+ USE demo ;
58
58
CREATE TABLE programming_language (
59
59
name VARCHAR (50 ) NOT NULL UNIQUE,
60
60
rating INT
Original file line number Diff line number Diff line change 19
19
<dependency >
20
20
<groupId >org.mariadb.jdbc</groupId >
21
21
<artifactId >mariadb-java-client</artifactId >
22
- <version >2.7.4 </version >
22
+ <version >3.1.2 </version >
23
23
</dependency >
24
24
</dependencies >
25
25
Original file line number Diff line number Diff line change @@ -99,14 +99,14 @@ private static void deleteData(String nameExpression) throws SQLException {
99
99
private static void initDatabaseConnection () throws SQLException {
100
100
System .out .println ("Connecting to the database..." );
101
101
connection = DriverManager .getConnection (
102
- "jdbc:mariadb://localhost:3306/jdbc_demo " ,
102
+ "jdbc:mariadb://localhost:3306/demo " ,
103
103
"user" , "password" );
104
104
System .out .println ("Connection valid: " + connection .isValid (5 ));
105
105
/*
106
106
* If you are using MariaDB SkySQL (https://mariadb.com/products/skysql),
107
107
* enable SSL and specify the path to the CA chain file that you can download
108
108
* from the SkySQL Portal (https://cloud.mariadb.com):
109
- * jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/jdbc_demo ?useSsl=true&
109
+ * jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/demo ?useSsl=true&
110
110
* serverSslCert=/path/to/your/skysql_chain.pem
111
111
*/
112
112
}
Original file line number Diff line number Diff line change @@ -63,12 +63,12 @@ dataSource.close();
63
63
Prepare the database:
64
64
65
65
``` sql
66
- CREATE DATABASE jdbc_demo ;
66
+ CREATE DATABASE demo ;
67
67
CREATE USER 'user '@' %' ;
68
- GRANT ALL ON jdbc_demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
68
+ GRANT ALL ON demo .* TO ' user' @' %' IDENTIFIED BY ' password' ;
69
69
FLUSH PRIVILEGES;
70
70
71
- USE jdbc_demo ;
71
+ USE demo ;
72
72
CREATE TABLE programming_language (
73
73
name VARCHAR (50 ) NOT NULL UNIQUE,
74
74
rating INT
Original file line number Diff line number Diff line change 19
19
<dependency >
20
20
<groupId >org.mariadb.jdbc</groupId >
21
21
<artifactId >mariadb-java-client</artifactId >
22
- <version >2.7.4 </version >
22
+ <version >3.1.2 </version >
23
23
</dependency >
24
24
25
25
<!-- Connection pool -->
Original file line number Diff line number Diff line change 1
1
# HikariCP database connection pool configuration
2
- jdbcUrl =jdbc:mariadb://localhost:3306/jdbc_demo
2
+ jdbcUrl =jdbc:mariadb://localhost:3306/demo
3
3
dataSource.username =user
4
4
dataSource.password =password
5
5
6
6
# If you are using MariaDB SkySQL (https://mariadb.com/products/skysql),
7
7
# enable SSL and specify the path to the CA chain file that you can download
8
8
# from the SkySQL Portal (https://cloud.mariadb.com):
9
9
#
10
- # jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/jdbc_demo ?useSsl=true&serverSslCert=/path/to/your/skysql_chain.pem
10
+ # jdbc:mariadb://demo-db0000xxxx.mdb000xxxx.db.skysql.net:5047/demo ?useSsl=true&serverSslCert=/path/to/your/skysql_chain.pem
You can’t perform that action at this time.
0 commit comments