p6spy / p6spy

P6Spy is a framework that enables database data to be seamlessly intercepted and logged with no code changes to the application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Driver com.microsoft.sqlserver.jdbc.SQLServerDriver claims to not accept jdbcUrl

JayChandler opened this issue · comments

commented

I am using p6spy in version 3.8.1! When i try to use an mssql jdb driver following error occurs

java.lang.RuntimeException: Driver com.microsoft.sqlserver.jdbc.SQLServerDriver claims to not accept jdbcUrl, jdbc:p6spy:sqlserver://fooServer:1433;DatabaseName=Foo-DB

I am connecting via HikariCP

 hikari:
      maximum-pool-size: 16
      pool-name: "Database pool"
      minimum-idle: 0
      auto-commit: true
      register-mbeans: true
      jdbc-url: "jdbc:p6spy:sqlserver://fooServer:1433;DatabaseName=Foo-DB"

without p6spy its working! Any ideas ?

I think you need to specify the JDBC driver class configuration option:

driver-class-name: com.p6spy.engine.spy.P6SpyDriver

Hi @JayChandler! I think @kekbur is right, spring boot can no longer determine driver class name automatically so you need to set it explicitly. I also had to move spring.datasource.hikari.jdbc-url to spring.datasource.url:

spring:
  datasource:
    driver-class-name: com.p6spy.engine.spy.P6SpyDriver
    url: "jdbc:p6spy:sqlserver://fooServer:1433;DatabaseName=Foo-DB"
    hikari:
      maximum-pool-size: 16
      pool-name: "Database pool"
      minimum-idle: 0
      auto-commit: true
      register-mbeans: true