JTDS ドライバーのさまざまなバージョンを何度か試してみましたが、うまくいきませんでした。Microsoft jar に切り替えて、ようやく成功しました。
**** jtds driver config ****
# Database configuration for M$ SqlServer <currently not working...jtds>
# db.default.url="jdbc:jtds:sqlserver://
an_ip_addy_to_a_server:1433/db_instance;user=user_name;password=user_password"
# db.default.driver=net.sourceforge.jtds.jdbc.Driver
**** M$ driver config ****
# Database configuration for M$ SqlServer <WORKING!!!..m$ driver>
db.default.url="jdbc:sqlserver://
an_ip_addy_to_a_server\db_instance:1433;user=user_name;password=user_password"
db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
違い??
1) sqljdbc4.jar は「管理されていない依存関係」です: http://www.playframework.com/documentation/2.1.0/SBTDependencies 2) URL 文字列は、私がそれぞれ読んだドキュメントごとに明らかに異なります。
少なくとも、私は今、前進を始めることができます。
-デイブ
私は Scala 言語とスタックに不慣れで、非常に簡単に解決できる問題を抱えています。
設定:
- Play2 (スカラ)
- スリック 1.0.0
- SQL Server 2008
- JTDS 1.3.0
アプリケーションを起動して最初のページ localhost:9000 にアクセスすると、フレームワークがデータベースへの接続を取得しようとしているように見えますが、例外がスローされています。
何かご意見は?
*** Build.scala ***
val appDependencies = Seq(
// Add your project dependencies here,
jdbc,
"com.typesafe.slick" %% "slick" % "1.0.0",
"ch.qos.logback" % "logback-classic" % "1.0.9",
"org.scalatest" % "scalatest_2.10" % "1.9.1" % "test",
"com.h2database" % "h2" % "1.3.170",
"net.sourceforge.jtds" % "jtds" % "1.3.0"
)
*** application.conf ***
# Database configuration for M$ SqlServer <currently not working>
#db.default.url="jdbc:jtds:sqlserver://server_name/server_instance;user=user_name;password=password"
#db.default.driver=net.sourceforge.jtds.jdbc.Driver
#db.default.user=user_name
#db.default.pass=password
db.default.defaultSchema=default_schema
*** application.log ***
2013-03-08 14:29:06,950 - [INFO] - from play in main
Listening for HTTP on /0:0:0:0:0:0:0:0:9000
2013-03-08 14:29:38,490 - [ERROR] - from com.jolbox.bonecp.hooks.AbstractConnectionHook in New I/O worker #1
Failed to obtain initial connection Sleeping for 0ms and trying again. Attempts left: 0. Exception: java.io.IOException: DB server closed connection.
2013-03-08 14:29:38,540 - [ERROR] - from application in New I/O worker #1
! @6dhc9mlf5 - Internal server error, for (GET) [/] ->
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:80) ~[play_2.10.jar:2.1.0]
at play.api.Configuration.reportError(Configuration.scala:558) ~[play_2.10.jar:2.1.0]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:251) ~[play-jdbc_2.10.jar:2.1.0]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:242) ~[play-jdbc_2.10.jar:2.1.0]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
at scala.collection.immutable.List.foreach(List.scala:309) ~[scala-library.jar:na]
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) ~[scala-library.jar:na]
at scala.collection.AbstractTraversable.map(Traversable.scala:105) ~[scala-library.jar:na]
at play.api.db.BoneCPPlugin.onStart(DB.scala:242) ~[play-jdbc_2.10.jar:2.1.0]
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63) ~[play_2.10.jar:2.1.0]
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63) ~[play_2.10.jar:2.1.0]
at scala.collection.immutable.List.foreach(List.scala:309) ~[scala-library.jar:na]
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:63) ~[play_2.10.jar:2.1.0]
at play.api.Play$$anonfun$start$1.apply(Play.scala:63) ~[play_2.10.jar:2.1.0]
at play.api.Play$$anonfun$start$1.apply(Play.scala:63) ~[play_2.10.jar:2.1.0]
at play.utils.Threads$.withContextClassLoader(Threads.scala:18) ~[play_2.10.jar:2.1.0]
at play.api.Play$.start(Play.scala:62) ~[play_2.10.jar:2.1.0]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$1.apply(ApplicationProvider.scala:133) ~[play_2.10.jar:2.1.0]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$1.apply(ApplicationProvider.scala:106) ~[play_2.10.jar:2.1.0]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:106) ~[play_2.10.jar:2.1.0]
at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:104) ~[play_2.10.jar:2.1.0]
at scala.util.Either$RightProjection.flatMap(Either.scala:523) [scala-library.jar:na]
at play.core.ReloadableApplication.get(ApplicationProvider.scala:104) ~[play_2.10.jar:2.1.0]
at play.core.server.Server$class.sendHandler$1(Server.scala:56) [play_2.10.jar:2.1.0]
at play.core.server.Server$$anonfun$getHandlerFor$4.apply(Server.scala:88) [play_2.10.jar:2.1.0]
at play.core.server.Server$$anonfun$getHandlerFor$4.apply(Server.scala:87) [play_2.10.jar:2.1.0]
at scala.util.Either$RightProjection.flatMap(Either.scala:523) [scala-library.jar:na]
at play.core.server.Server$class.getHandlerFor(Server.scala:87) [play_2.10.jar:2.1.0]
at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:34) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler.messageReceived(PlayDefaultUpstreamHandler.scala:103) [play_2.10.jar:2.1.0]
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty.jar:na]
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565) [netty.jar:na]
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793) [netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpContentDecoder.messageReceived(HttpContentDecoder.java:104) [netty.jar:na]
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty.jar:na]
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565) [netty.jar:na]
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793) [netty.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) [netty.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:455) [netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:538) [netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:437) [netty.jar:na]
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty.jar:na]
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565) [netty.jar:na]
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560) [netty.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:84) [netty.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:472) [netty.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:333) [netty.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35) [netty.jar:na]
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) [netty.jar:na]
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_17]
Caused by: java.sql.SQLException: I/O Error: DB server closed connection.
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2388) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:609) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:369) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:183) ~[jtds-1.3.0.jar:1.3.0]
at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.7.0_17]
at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.7.0_17]
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256) ~[bonecp.jar:0.7.1.RELEASE]
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:305) ~[bonecp.jar:0.7.1.RELEASE]
at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150) ~[bonecp.jar:0.7.1.RELEASE]
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112) ~[bonecp.jar:0.7.1.RELEASE]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:244) ~[play-jdbc_2.10.jar:2.1.0]
... 54 common frames omitted
Caused by: java.io.IOException: DB server closed connection.
at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:883) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:762) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114) ~[jtds-1.3.0.jar:1.3.0]
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2282) ~[jtds-1.3.0.jar:1.3.0]
... 64 common frames omitted