Skip to content

Instantly share code, notes, and snippets.

@nunomazer
Created July 4, 2021 14:20
Show Gist options
  • Save nunomazer/ff3771469e0aa6f3663889f52f98ba8b to your computer and use it in GitHub Desktop.
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
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