[akka-user] Re: Help with exception with Slick JDBC connector for MS SQL Server

2017-11-15 Thread 'indusbull' via Akka User List
My bad. It was typo while I was formatting to post here. Corrected app.conf 
with same exception -

application.config
slick-sqlserver {
 profile = "slick.jdbc.SQLServerProfile$" 

 db { 

 dataSourceClass = "slick.jdbc.DriverDataSource" 

 properties = { 

  driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver" 
  url = "jdbc:sqlserver://host:1433;databaseName=dbname"

 user = "username" 
  password = "password" 
 }
  }
}






On Monday, November 13, 2017 at 4:11:34 PM UTC-6, lutzh wrote:
>
> It doesn't really match the error message, but your "driver" entry looks a 
> bit off to me - shouldn't that just be the driver class name?
>
> I think the ";databaseName=" would be attached to the 
> URL part, not the driver. And the 3 before the ";", I don't know..
>
>
>
>
> On Monday, November 13, 2017 at 8:19:35 PM UTC+1, indusbull wrote:
>>
>> I am trying Slick (JDBC) Connector tutorial 
>>  to 
>> connect to MS SQL Server 2012 in my prototype Java Akka project. But I am 
>> having difficulties since last few hours to connect to DB through JDBC. It 
>> keeps throwing below exception - Not sure what I am missing either in 
>> config or code. It is simple example.
>>
>> Exception:
>> java.sql.SQLTransientConnectionException: slick-sqlserver.db - Connection 
>> is not available, request timed out after 1001ms. at 
>> com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:548)
>>  
>> at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:186) at 
>> com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145) at 
>> com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:83) 
>> at 
>> slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:14)
>>  
>> at slick.jdbc.JdbcBackend$BaseSession.(JdbcBackend.scala:438) at 
>> slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:46) at 
>> slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:37) at 
>> slick.basic.BasicBackend$DatabaseDef.acquireSession(BasicBackend.scala:216) 
>> at 
>> slick.basic.BasicBackend$DatabaseDef.acquireSession$(BasicBackend.scala:215) 
>> at slick.jdbc.JdbcBackend$DatabaseDef.acquireSession(JdbcBackend.scala:37) 
>> at slick.basic.BasicBackend$DatabaseDef$$anon$3.run(BasicBackend.scala:279) 
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at 
>> java.lang.Thread.run(Unknown Source)
>>
>> application.config
>> slick-sqlserver {
>>  profile = "slick.jdbc.SQLServerProfile$" 
>>
>>  db { 
>>
>>  dataSourceClass = "slick.jdbc.DriverDataSource" 
>>
>>  properties = { 
>>
>>   driver = 
>> "com.microsoft.sqlserver.jdbc.SQLServerDriver3;databaseName=dbname" 
>>   url = "jdbc:sqlserver://host:1433" 
>>   user = "username" 
>>   password = "password" 
>>  }
>>   }
>> }
>>
>> My Code
>>
>> ActorSystem system = ActorSystem.create("testSystem");
>> final Materializer materializer = ActorMaterializer.create(system);final 
>> SlickSession session = SlickSession.forConfig("slick-sqlserver");
>>
>> final CompletionStage done =
>>   Slick
>> .source(
>>   session,
>>   "SELECT 1",
>>   //(SlickRow row) -> new Object(row.nextInt(), row.nextString())
>>   (SlickRow row) -> new Object()
>> )
>> .log("user")
>> .runWith(Sink.ignore(), materializer);
>>
>> done.whenComplete((value, exception) -> {
>>   session.close();
>>   system.terminate();
>> });`
>>
>>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Help with exception with Slick JDBC connector for MS SQL Server

2017-11-13 Thread lutzh
It doesn't really match the error message, but your "driver" entry looks a 
bit off to me - shouldn't that just be the driver class name?

I think the ";databaseName=" would be attached to the 
URL part, not the driver. And the 3 before the ";", I don't know..




On Monday, November 13, 2017 at 8:19:35 PM UTC+1, indusbull wrote:
>
> I am trying Slick (JDBC) Connector tutorial 
>  to 
> connect to MS SQL Server 2012 in my prototype Java Akka project. But I am 
> having difficulties since last few hours to connect to DB through JDBC. It 
> keeps throwing below exception - Not sure what I am missing either in 
> config or code. It is simple example.
>
> Exception:
> java.sql.SQLTransientConnectionException: slick-sqlserver.db - Connection 
> is not available, request timed out after 1001ms. at 
> com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:548) 
> at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:186) at 
> com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145) at 
> com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:83) 
> at 
> slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:14)
>  
> at slick.jdbc.JdbcBackend$BaseSession.(JdbcBackend.scala:438) at 
> slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:46) at 
> slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:37) at 
> slick.basic.BasicBackend$DatabaseDef.acquireSession(BasicBackend.scala:216) 
> at 
> slick.basic.BasicBackend$DatabaseDef.acquireSession$(BasicBackend.scala:215) 
> at slick.jdbc.JdbcBackend$DatabaseDef.acquireSession(JdbcBackend.scala:37) 
> at slick.basic.BasicBackend$DatabaseDef$$anon$3.run(BasicBackend.scala:279) 
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at 
> java.lang.Thread.run(Unknown Source)
>
> application.config
> slick-sqlserver {
>  profile = "slick.jdbc.SQLServerProfile$" 
>
>  db { 
>
>  dataSourceClass = "slick.jdbc.DriverDataSource" 
>
>  properties = { 
>
>   driver = 
> "com.microsoft.sqlserver.jdbc.SQLServerDriver3;databaseName=dbname" 
>   url = "jdbc:sqlserver://host:1433" 
>   user = "username" 
>   password = "password" 
>  }
>   }
> }
>
> My Code
>
> ActorSystem system = ActorSystem.create("testSystem");
> final Materializer materializer = ActorMaterializer.create(system);final 
> SlickSession session = SlickSession.forConfig("slick-sqlserver");
>
> final CompletionStage done =
>   Slick
> .source(
>   session,
>   "SELECT 1",
>   //(SlickRow row) -> new Object(row.nextInt(), row.nextString())
>   (SlickRow row) -> new Object()
> )
> .log("user")
> .runWith(Sink.ignore(), materializer);
>
> done.whenComplete((value, exception) -> {
>   session.close();
>   system.terminate();
> });`
>
>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.