How to connect to MySQL Database from Kotlin using JDBC

Kotlin Tutorial – We shall learn to connect to MySQL Database from Kotlin using JDBC with the help a Kotlin Example Program.

Following is a step by step process explained to connect to MySQL Database from Kotlin using JDBC :

Step 1 : Add MySQL connector for java

MySQL connector for java works for Kotlin as well. Download MySQL connector for java, mysql-connector-java-5.1.42-bin.jar , from https://dev.mysql.com/downloads/connector/j/5.1.html. Open IntelliJ IDEA, Click on File in Menu, Click on Project Structure, Click on Libraries on the left panel, and add the jar to Libraries.