Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schema Spy unable to find postgresql driver

I want to use Schema Spy to generate schema diagrams,

I have specifed the following command

java -jar schemaSpy_5.0.0.jar -t pgsql -host 10.100.71.21[:5432] -db mydb -s public -u username -p password -dp postgresql-8.0-312.jdbc3.jar -o output/

I have the postgresql driver jar file in the same directory as schema spy jar file. But it gives the following error

[schemaSpy_5.0.0.jar]/net/sourceforge/schemaspy/dbTypes/pgsql.properties
java.lang.ClassNotFoundException: org.postgresql.Driver

Failed to load driver 'org.postgresql.Driver'from: [file:/home/panx/postgresql-8.0- 312.jdbc3.jar]
This entry doesn't point to a valid file/directory: [/whereever/postgresql-8.0-312.jdbc3.jar]

Use the -dp option to specify the location of the database
 drivers for your database (usually in a .jar or .zip/.Z).

Any help would be appreciated.

Thanks,

Pankaj

like image 374
Pankaj Bhambhani Avatar asked Apr 05 '12 13:04

Pankaj Bhambhani


3 Answers

First you need to download the actual driver Here.
Then run with set path to Driver For example for Windows

java -jar schemaSpy.jar  -t pgsql -host localhost:5432 -db _dbname_ -s _schena_name_ -u postgres -p  -o D:\RVA\postgreSQL\  -dp "D:\Program Files (x86)\PostgreSQL\pgJDBC\postgresql-42.2.5.jar"
like image 72
Валерий Рязанов Avatar answered Oct 07 '22 17:10

Валерий Рязанов


I think the problem is you didn't add the classpath to the driver. You have to add your classpath like this

java -jar schemaSpy_5.0.0.jar -t pgsql -host 10.100.71.21[:5432] -db mydb -s public -u username -p password -dp /home/panx/postgresql-8.0-312.jdbc3.jar -o output/
If it does not work you can download the source code of this project. In the project there is pgsql.properties file in dbTypes folder. You can change it with your classpath and I think this solves your problem.
like image 43
mbaydar Avatar answered Oct 07 '22 18:10

mbaydar


I'd like to add a few points.

  1. You would be using Schema Spy with Graphviz. Versions 2.31+ does not add an entry to Window's System path variable. So after you download and install Graphviz update the path variable to have path till Graphviz's bin directory. (C:\Program Files (x86)\Graphviz2.38\bin)
  2. Alternative to downloading entire project source to change the classpath in the property file would be to update the jar using 7-zip.
  3. Open the jar file using 7-zip navigate to net/sourceforge/schemaspy/dbTypes/ right click pgsql.properties say edit.
  4. Change the following entry for driverPath to make it point to jdbc jar file driverPath=D:/Work/JavaProjects/tools/postgresql-9.3-1100.jdbc4.jar
  5. Click on save and update. This should do the trick.
like image 26
jithin iyyani Avatar answered Oct 07 '22 18:10

jithin iyyani