Giter Club home page Giter Club logo

Comments (10)

loicdescotte avatar loicdescotte commented on June 7, 2024

Hi,
I'm not sure it's play-slick specific problem

from play-slick.

iammichiel avatar iammichiel commented on June 7, 2024

In fact, it is. Check out the following file : Database.scala line 20

private def driverByName : String => Option[ExtendedDriver] = Map(
     "org.apache.derby.jdbc.EmbeddedDriver" -> DerbyDriver
     ,"org.h2.Driver" -> H2Driver
     ,"org.hsqldb.jdbcDriver" -> HsqldbDriver
     ,"com.mysql.jdbc.Driver" -> MySQLDriver
     ,"org.postgresql.Driver" -> PostgresDriver
     ,"org.sqlite.JDBC" -> SQLiteDriver
     ,"com.microsoft.sqlserver.jdbc.SQLServerDriver" -> SQLServerDriver
).get(_)

When using log4jdbc, you have to use the net.sf.log4jdbc.DriverSpy which results in a unknown driver exception.

from play-slick.

freekh avatar freekh commented on June 7, 2024

I do not know log4jdbc enough: which Slick driver it should use, how should it behave? From looking at Slick there is no driver for log4jdbc, but I guess log4jdbc is just a proxy right?

NOTE: you can still use play-slick, but you have to figure out which driver to use on your own.

from play-slick.

iammichiel avatar iammichiel commented on June 7, 2024

Indeed, log4jdbc is nothing more than an jdbc proxy. In order to find the right driver, log4jdbc inspects the jdbc connection url in order to extract the used driver. To integrate this into Play-Slick, one should :

  1. Check the driver provided, if net.sf.log4jdbc.DriverSpy then go to 2.
  2. Check the connection url and perform the same analysis log4jdbc does.

However, this seems to be a bit far-fetched for simple debugging. I suggest putting this on standby. I will take a look at this next week when I will have some more time.

from play-slick.

freekh avatar freekh commented on June 7, 2024

Sure. PRs are welcome! We are trying to get into Play20, so I am not sure if an eventual PR would make it directly, but we can see how we manage that when the times comes :)

from play-slick.

freekh avatar freekh commented on June 7, 2024

@iammichiel hey! I was just wondering if you had the time to make a PR happen?

from play-slick.

iammichiel avatar iammichiel commented on June 7, 2024

Indeed, I have tried a few things but it seems pretty hard to make something "clean". I'll let you know if it works out. 

from play-slick.

freekh avatar freekh commented on June 7, 2024

Alright - cool that you have tried Just so it is said: I don't mind reviewing it and give feedback (I will be polite :) if you want to send in a PR. I can't test it though so I will have to rely on you for that...

from play-slick.

francisdb avatar francisdb commented on June 7, 2024

Should be fairly easy to set up a test for this. Would it be an option to make the slick driver configurable in the application.conf which would take priority to the driverByName? Or allowing the user to provide a different driverByName function by implementing some trait?

from play-slick.

freekh avatar freekh commented on June 7, 2024

I am not sure if one of you gave me that PR - but the PR that let's you configure the driver is now in and it should resolve this. Closing for now...

from play-slick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.