On Saturday 03 December 2005 13:17, Phil Burness wrote:
On Saturday 03 December 2005 17:23, Randall R Schulz wrote:
Phil,
On Saturday 03 December 2005 08:28, Phil Burness wrote:
On Saturday 03 December 2005 16:06, Randall R Schulz wrote:
...
For starters, why don't you state the specific invocation you used?
Phil
Randall Schulz
My specific invocation was :- java -cp /home/pburness/mysql-connector-java-3.0.17/mysql-connector-java-3 .0.1 7-ga-bin.jar -jar schemaSpy_2.1.0.jar -t mysql -db tract -o library -u phil -p xxxx -host localhost -s mysql -all
I notice your using a different version of connector - I tried 3.1.12 and that didn't work either. Did you get the 3.1.11 from the mysql website?
Yes. I guess 3.1.12 came out some time in the past few weeks, since the time I downloaded it. I have applications that require at least 3.1.11.
It appears there are unstated requirements on the order of the various options. When I copied the sample invocation from the Web page and modified it for MySQL and my local setup, I got the same symptom you reported:
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- Failed to load driver [com.mysql.jdbc.Driver] from classpath []
Use -t [databaseType] to specify what drivers to use or modify one of the .properties from the jar, put it on your file system and point to it with -t [databasePropertiesFile].
For many people it's easiest to use the -cp option to directly specify where the database drivers exist (usually in a .jar or .zip/.Z).
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at net.sourceforge.schemaspy.Main.getConnection(Main.java:429) at net.sourceforge.schemaspy.Main.main(Main.java:122) -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
I verified that the class being loaded does exist in my Connector/J JAR file:
% jar tf .../mysql-connector-java-3.1.11-bin.jar |egrep Driver com/mysql/jdbc/Driver.class com/mysql/jdbc/NonRegisteringDriver.class com/mysql/jdbc/NonRegisteringReplicationDriver.class com/mysql/jdbc/ReplicationDriver.class org/gjt/mm/mysql/Driver.class
I'm a bit puzzled by the "classpath []" in the diagnostic. I wonder how the program is discovering the class path and why it does not reflect the actual invocation.
Waaait a minute. I see the confusion. The "-cp" is an argument to schemaSpy, not to the JVM (the author chose the same option, which I'd consider a bad choice, insofar as it confuses weak minds such as my own).
Yup. Giving the -cp .../mysql-connector-java-3.1.11-bin.jar option allows it to load the driver. Now it seems to hang here:
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- Using database properties:
[/acquisitions/schemaSpy_2.1.0.jar]/net/sourceforge/schemaspy/dbTyp es/mysql .properties Connected to MySQL - 4.1.13-Max-log
Gathering schema details........ -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
At this point there's no CPU utilization and MySQL is not running any queries on behalf of schemaSpy (ascertained by logging in to MySQL on another shell and using the "show full processlist" command).
SchemaSpy produced a skeleton directory structure in the output directory I specified:
% find mylocal mylocal mylocal/tables mylocal/graphs mylocal/graphs/summary
By the way, I extracted the MySQL configuration file from the schemaSpy JAR file:
% jar xf \ schemaSpy_2.1.0.jar \ net/sourceforge/schemaspy/dbTypes/mysql.properties
% mv net/sourceforge/schemaspy/dbTypes/mysql.properties .
% egrep driverPath mysql.properties driverPath=c:/mysql/mysql-connector-java-3.1.8-bin.jar
I think this is where the driver is loaded from if you don't override it with the -cp option. You can put a corrected "mysql.properties" file in the invocation directory if you don't want to include the -cp option. Since I just make cover scripts for such things, it's easier for me to include the -cp option there than it is to have a properties file.
Good luck. Let me know if you can get farther than I did.
Randall - I haven't a chance!
Interested to read through your notes but I'm not good with Java and don't know how to proceed....
Sorry. It's actually simple enough, if you cut to the chase instead of getting the blow-by-blow that I gave you. Try this: Create an "sspy" script (be sure to "chmod +x sspy"): -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- #!/bin/bash --norc classPath="/usr/share/java/mysql-connector-java.jar" export CLASSPATH="$classPath" exec \ java \ -jar /acquisitions/schemaSpy_2.1.0.jar \ -t mysql \ -cp "$classPath" \ "$@" -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- (For whatever funky reason, you need the Connector/J JAR both in the Java class path _and_ in the -cp argument to schemaSpy itself.) Be sure to correct the path names for your system. Based on my experience, I recommend you use 3.1.12 of Connector/J. The one you have should be OK or you can install the latest mysql-connector-java package from the Packman repository (mysql-connector-java-3.1.12-0.pm.0). If you want to see the pretty graphical database diagrams, install this RPM: <http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.6-1.fc4.i386.rpm> Now invoke it like this: % sspy -db tract -o library -u phil -p X -host localhost -s mysql -all That should do it. Again, good luck. If you still have problems, feel free to report back.
Phil
Randall Schulz