Created
July 4, 2021 14:20
-
-
Save nunomazer/ff3771469e0aa6f3663889f52f98ba8b to your computer and use it in GitHub Desktop.
Exemplo de uma conexão com banco de dados MySQL usando Kotlin e JDBC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val connectionProps = Properties() | |
connectionProps.put("user", username) | |
connectionProps.put("password", password) | |
try { | |
Class.forName("com.mysql.jdbc.Driver").newInstance() | |
conn = DriverManager.getConnection(“url”, connectionProps) | |
} catch (ex: SQLException) { | |
// handle any errors | |
ex.printStackTrace() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment