Search code examples
javapostgresqlmavenjdbcycsb

Installing JDBC driver in YCSB project


I want to benchmark PostgreSQL with the YCSB framework. Therefore I am following the instructions of the projects Github site for using the JDBC library.

The given example says you need a JDBC Driver which i downloaded from this site. The file I used (not sure whether it is the right one) is the JDBC3 Postgresql Driver, Version 9.3-1103. Now I am not sure where to place the downloaded jar in order to run the project. So far I tried to place the JAR in the bin folder before executing the command $ ./bin/ycsb load jdbc -s -P workloads/workloada. This resulted in the following error.

Error in database operation: java.sql.SQLException: No suitable driver found for jdbc:postgresql://127.0.0.1:5432/ycsb?user=postgres&password=password

Obviously placing the driver JAR in the bin folder did not turn out to be the right location or maybe it is simply the wrong JAR. Can somebody tell me where I have to place the driver and whether the downloaded jar is the correct one?


Solution

  • What helped me was the following. Although I am sure there are better ways to do this.

    I added the following dependency to the POM.xml.

    <dependency>
      <groupId>com.postgres.driver</groupId>
      <artifactId>postgresdriver</artifactId>
      <version>9.3</version>
      <scope>system</scope>
      <systemPath> "Path to JAR on filesystem" </systemPath>
    </dependency>
    

    groupId and artifactId can be chosen as you want and version is optional. The scope should be set to system and the systemPath has to point to the JAR on the filesystem (e.g. /home/user/driver.jar)