简体   繁体   中英

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?

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 (eg /home/user/driver.jar )

The Jar just needs to be on the classpath in one way or another. You can just specify the jar path like so:

./bin/ycsb load jdbc -s -P workloads/workloada -cp /path/to/jar

-cp lets you manually add things to the classpath

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM