Quantcast
Channel: alvinalexander.com - mysql
Viewing all articles
Browse latest Browse all 28

How to connect to a MySQL database with Scala and JDBC

$
0
0

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 16.1, “How to connect to a MySQL database with Scala and JDBC.”

Problem

You want to connect to a MySQL database (or any other database with a JDBC driver) from a Scala application using “plain old JDBC.”

Solution

Use JDBC just like you would in a Java application. Download the MySQL JDBC driver, and then access your database with code like this:

read more


Viewing all articles
Browse latest Browse all 28

Trending Articles