I’m starting to learn Scala. It’s a statically- and strongly-typed functional language that compiles to Java byte code and integrates well with Java.
One of the things I’m struggling with is the language’s strong static typing. Scala is nice in that it tries very hard to infer types. That means the programmer doesn’t spend much time typing “wasteful” type declarations. If Scala didn’t have that, I would have run away screaming already.
I’ve figured out how to connect to a MySQL database. There are a few database access methods that are being developed in Scala. The one that ships with the language is called “dbc”. It comes with a PostgreSQL connection interface but no MySQL version. Here’s my MySQL version along with some simple code that performs a select. (I’d move the connection information into a properties file if I were to really use this code.)