Skip to content

Instantly share code, notes, and snippets.

@pazworld
Last active December 16, 2015 17:40
Show Gist options
  • Save pazworld/5472112 to your computer and use it in GitHub Desktop.
Save pazworld/5472112 to your computer and use it in GitHub Desktop.
package controllers
import play.api._
import play.api.mvc._
import play.api.db._
import play.api.Play.current
import anorm._
import java.sql._
object Application extends Controller {
def index = Action {
val prop = new java.util.Properties
prop.put("charSet", "SJIS")
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
implicit val connection = DriverManager.getConnection("jdbc:odbc:TESTDB", prop)
val firstRow = SQL("select * from テーブル1").apply.head
val id = firstRow[Long]("番号")
val name = firstRow[String]("名前")
connection.close
Ok(views.html.index(id + ", " + name))
}
}
@(message: String)
@main("test") {
@message
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment