connecting to redshift with amazon driver

531 views
Skip to first unread message

Alan Nichol

unread,
Feb 19, 2016, 8:27:48 AM2/19/16
to HikariCP
if I try and connect as follows: 

(I'm coding in Scala)


 

    val dataSource
: DataSource = { 

      val ds 
= new HikariDataSource() 

      ds
.setDataSourceClassName("com.amazon.redshift.jdbc41.Driver") 

      ds
.addDataSourceProperty("url", url) 

      ds
.addDataSourceProperty("user", user) 

      ds
.addDataSourceProperty("password", pw) 

      ds 

    
}



I get the error:

cannot cast com.amazon.redshift.jdbc41.Driver to javax.sql.DataSource


Do I need to switch to a vanilla postgres driver?


Nitin Chauhan

unread,
Feb 19, 2016, 10:55:17 AM2/19/16
to HikariCP
you are passing 'driver' name for method that expects 'datasource'.

try:
HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl("jdbc:redshift://server:port/database");
ds.setUsername(username);
ds.setPassword(password);

Brett Wooldridge

unread,
Feb 20, 2016, 12:45:51 AM2/20/16
to HikariCP
Nitin is correct.  I can also tell you that Redshift is known to be working with HikariCP, so whatever issues you might encounter are likely to be configuration related rather than a problem with HikariCP.


Reply all
Reply to author
Forward
0 new messages