// grab the extension val dbSupport = Database(actorSystem) val result = for{ // open the connection asynchronously connection <- dbSupport.connect() // Execute a query quest newestEmployee <- connection.executeQuery( "SELECT first_name,last_name,hire_date FROM employees " + "ORDER BY hire_date DESC " + "LIMIT 0,5") // When the results arrived, close the connection _ <- connection.close() } yield newestEmployee // Process the results result.onSuccess{ case resultSet =>{ resultSet.foreach{ row => println(row("first_name").getString + " "+row("first_name").getString + " since " + row("hire_date").getString ) } } }.onFailure{ case e:Exception =>{ e.printStackTrace() } }