From 6232d8df510847dd43dffbedb929446b97d2f169 Mon Sep 17 00:00:00 2001 From: Thomas BREIL Date: Mon, 18 Sep 2023 17:21:22 +0200 Subject: [PATCH] add Database linking template --- src/main/kotlin/DataBase.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/kotlin/DataBase.kt diff --git a/src/main/kotlin/DataBase.kt b/src/main/kotlin/DataBase.kt new file mode 100644 index 0000000..2e78a8e --- /dev/null +++ b/src/main/kotlin/DataBase.kt @@ -0,0 +1,15 @@ +import java.sql.DriverManager + +// the model class +data class User(val id: Int, val name: String) + +fun main(){ + + + val connection = DriverManager.getConnection( + "jdbc:mysql://localhost:3306/sae", + "root", "0000"); + + // prints true if the connection is valid + println(connection.isValid(0)) +} \ No newline at end of file