Connection to MS SQL 2014

484 views
Skip to first unread message

Arsen Anay

unread,
Apr 23, 2016, 2:15:01 AM4/23/16
to play-framework
Hello, everybody. I can not connect play framework 2.5.2 to ms sql database 2014. Please help me!

Greg Methvin

unread,
Apr 23, 2016, 6:32:47 AM4/23/16
to play-framework
Hi Arsen,

I'm sure people here could help, but it'd be more useful if you showed what you've already tried and the specific problems you are having.

Greg

On Fri, Apr 22, 2016 at 11:15 PM, Arsen Anay <arse...@gmail.com> wrote:
Hello, everybody. I can not connect play framework 2.5.2 to ms sql database 2014. Please help me!

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/b37303b5-0d6e-4ea5-b0ff-e8142530a567%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Greg Methvin
Senior Software Engineer

Arsen Anay

unread,
Apr 24, 2016, 4:44:07 AM4/24/16
to play-framework
Here they are:
build.sbt:

"net.sourceforge.jtds" % "jtds" % "1.3.1",

application.conf:

jpa.dialect=org.hibernate.dialect.SQLServerDialect
db {
default {
username=user,
password="pass",
url="jdbc:sqlserver://localhost:1433/mydb",
driver="net.sourceforge.jtds.jdbc.Driver"
}
}

Igmar Palsenberg

unread,
Apr 25, 2016, 7:32:57 AM4/25/16
to play-framework


Op zaterdag 23 april 2016 08:15:01 UTC+2 schreef Arsen Anay:
Hello, everybody. I can not connect play framework 2.5.2 to ms sql database 2014. Please help me!

Start with your config in build.sbt, and describe the issue you're having.


Igmar 

Arsen Anay

unread,
Apr 25, 2016, 7:34:13 AM4/25/16
to play-framework
Hi. I've already posted my conf

Arsen Anay

unread,
Apr 25, 2016, 7:36:23 AM4/25/16
to play-framework
Error message is that app cannot connect to db. But actually I created db with same name as in conf. Even login role.


On Monday, April 25, 2016 at 5:32:57 PM UTC+6, Igmar Palsenberg wrote:

Arsen Anay

unread,
Apr 26, 2016, 1:15:29 AM4/26/16
to play-framework
Cannot connect to database [default]
db {
17  default {
18    url="jdbc:sqlserver://localhost:1433/mydb",

Igmar Palsenberg

unread,
Apr 26, 2016, 5:15:38 AM4/26/16
to play-framework


Op dinsdag 26 april 2016 07:15:29 UTC+2 schreef Arsen Anay:
You're sure there is a DB listening on port 1433 ? Normally, that port is closed by default. Usually, a telnet localhost 1433 will tell you. If that doesn't work, bump the driver's loglevel.


Igmar 

Arsen Anay

unread,
Apr 27, 2016, 1:12:45 AM4/27/16
to play-fr...@googlegroups.com
Where can I find the log files of driver?

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/oI3fDoNSf1M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d85ce921-adeb-4585-abff-fe5b0145bf21%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Arsen Anay.

Arsen Anay

unread,
Apr 27, 2016, 1:18:36 AM4/27/16
to play-fr...@googlegroups.com
Caused by: java.lang.RuntimeException: Driver net.sourceforge.jtds.jdbc.Driver claims to not accept JDBC URL jdbc:sqlserver://localhost:1433/mydb
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:84)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:296)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:84)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:102)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:58)
at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:54)
at scala.util.Try$.apply(Try.scala:192)
at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:54)
... 72 common frames omitted
--
Arsen Anay.

Igmar Palsenberg

unread,
Apr 27, 2016, 6:09:47 AM4/27/16
to play-framework


Op woensdag 27 april 2016 07:18:36 UTC+2 schreef Arsen Anay:
Caused by: java.lang.RuntimeException: Driver net.sourceforge.jtds.jdbc.Driver claims to not accept JDBC URL jdbc:sqlserver://localhost:1433/mydb

It is most likely jdbc:jtds:sqlserver://localhost:1433/mydb
That that one.


Igmar

Vishwajeet Kore

unread,
Apr 28, 2016, 12:34:16 AM4/28/16
to play-framework
Hello sir there is my problem please tell me any hint  about it.


application.conf File as below
------------------------------------------------------------
db {
    default {
    
    db.default.url="jdbc:jtds:sqlserver://127.0.0.1:1433/DBNAME",
    db.default.driver=net.sourceforge.jtds.jdbc.Driver,
    db.default.user=sa,
    db.default.pass=pass  
 }
--------------------------------------------------
I added jtds-1.2.6 jar in lib and libexec folder.
----------------------------------------------------------------------------------------------
build.sbt file as below.
----------------------------------------------------------------------------------------
libraryDependencies ++= Seq(
  javaJdbc,
  
  "net.sourceforge.jtds" % "jtds" % "1.2.6",
  cache,
  javaWs
)


fork in run := true
--------------------------------------------------------------------------------------


but when i go to browser at http://localhost:9000/ i get following error

Cannot connect to database [default]

please help me any one.

Igmar Palsenberg

unread,
Apr 28, 2016, 3:53:45 AM4/28/16
to play-framework
 
but when i go to browser at http://localhost:9000/ i get following error

Cannot connect to database [default]

please help me any one.

Please post the exception you het in the logs / console. The normal error Play renders is usually not very helpful.



Igmar 

Vishwajeet Kore

unread,
Apr 28, 2016, 3:55:49 AM4/28/16
to play-framework
Following is the exception:

  • application - Creating Pool for datasource 'default'
  • c.z.h.HikariConfig - either dataSource or dataSourceClassName is required
  • application -
  • ! @7003ao8o8 - Internal server error, for (GET) [/] ->
  • play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
  • at play.api.Configuration$.configError(Configuration.scala:154)
  • at play.api.Configuration.reportError(Configuration.scala:806)
  • at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
  • at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
  • at scala.collection.immutable.List.foreach(List.scala:381)
  • at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
  • at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
  • at play.api.db.DBApiProvider.get(DBModule.scala:62)
  • at play.api.db.DBApiProvider.get(DBModule.scala:58)
  • at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)

Arsen Anay

unread,
Apr 28, 2016, 3:55:57 AM4/28/16
to play-fr...@googlegroups.com
Mr. Vishwajeet Kore. It will be useful for me as well, if we will find out the solution to connect to MS SQL)

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/oI3fDoNSf1M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Arsen Anay.

Vishwajeet Kore

unread,
Apr 28, 2016, 4:14:28 AM4/28/16
to play-framework
@Arsen Anay yes, but i can get what i am doing wrong!!

Vishwajeet Kore

unread,
Apr 28, 2016, 4:16:42 AM4/28/16
to play-framework
@Arsen Anay, I can not getting what i m doing wrong.

Dosmukhamed Zh.

unread,
Apr 28, 2016, 4:29:40 AM4/28/16
to play-framework
hello, u've already writen db.default in scobes, try this:
application.conf File as below
------------------------------------------------------------
db {
    default {
    
    url="jdbc:jtds:sqlserver://127.0.0.1:1433/DBNAME",
    driver=net.sourceforge.jtds.jdbc.Driver,
    user=sa,
    pass=pass  
 }

Vishwajeet Kore

unread,
Apr 28, 2016, 4:56:30 AM4/28/16
to play-framework
Hi!! thanks for reply i edited my application.conf as
db {
    default {
    
    url="jdbc:jtds:sqlserver://127.0.0.1:1433/DBNAME",
    driver=net.sourceforge.jtds.jdbc.Driver,
    user=sa,
    pass=pass  
 }


but still one exception occurs:

    • play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
    • at play.api.Configuration$.configError(Configuration.scala:154)
    • at play.api.Configuration.reportError(Configuration.scala:806)
    • at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
    • at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
    • at scala.collection.immutable.List.foreach(List.scala:381)
    • at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
    • at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
    • at play.api.db.DBApiProvider.get(DBModule.scala:62)
    • at play.api.db.DBApiProvider.get(DBModule.scala:58)
    • at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    • Caused by: play.api.Configuration$$anon$1: Configuration error[Exception during pool initialization: HikariPool-0 - Connection is not available, request timed out after 30000ms.]

    Please Help me. what is this?
    or please tell me any another seting is neccessry in any conf file or other file?
    please help me.

    Dosmukhamed Zh.

    unread,
    Apr 28, 2016, 6:31:26 AM4/28/16
    to play-framework

    use Unmanaged dependencies place Microsoft JDBC Driver (sqljdbc42.jar) in /lib

    in application.conf
    db {
    default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver,
    default.url="jdbc:sqlserver://127.0.0.1:1541;databaseName=yourdatabasename",
    default.username=username,
    default.password="password"
    }

    port of your mssql server you can find in "Sql Server Configuration Manager", my was mssql server was using port 1541

    u can checkout sample project here


    Arsen Anay

    unread,
    Apr 28, 2016, 6:39:15 AM4/28/16
    to play-fr...@googlegroups.com
    Thanks a lot. If anyone will find solution using repo, please inform

    --
    You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/oI3fDoNSf1M/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



    --
    Arsen Anay.

    Vishwajeet Kore

    unread,
    Apr 28, 2016, 10:57:46 AM4/28/16
    to play-framework
    Hello  Dosmukhamed Zh,

    Thanks it work as you told with Microsoft JDBC Driver (sqljdbc42.jar).

    but it is not working with jtds.

    Vishwajeet Kore

    unread,
    Apr 29, 2016, 2:27:13 AM4/29/16
    to play-framework
    Please tell me how to do it with jtds server i got error with it.

    • ! @700a63631 - Internal server error, for (GET) [/] ->
    • play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
    • at play.api.Configuration$.configError(Configuration.scala:154)
    • at play.api.Configuration.reportError(Configuration.scala:806)
    • at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
    • at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
    • at scala.collection.immutable.List.foreach(List.scala:381)
    • at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
    • at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
    • at play.api.db.DBApiProvider.get(DBModule.scala:62)
    • at play.api.db.DBApiProvider.get(DBModule.scala:58)
    • at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    • Caused by: play.api.Configuration$$anon$1: Configuration error[Exception during pool initialization: HikariPool-4 - Connection is not available, request timed out after 30000ms.]
    Reply all
    Reply to author
    Forward
    0 new messages