Last active
December 16, 2015 17:40
-
-
Save pazworld/5472112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(message: String) | |
@main("test") { | |
@message | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment