Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
Subject: mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Subject: Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
Subject: MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Subject: Re: Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Subject: problem to solve classpath

Subject: problem to solve classpath

2007-11-09       - By Michel Maria-Sube

 Back
Hello,

I'm working under UNIX Suse 10.2 and using version
3.1.14 of jdbc; my application is apparently unable to
find path of classes defined in the jdbc archive. At
the beginning, application try to load driver class as
follows:

import  javax.swing.*;
import  java.lang.*;
import  java.net.*;
import  java.awt.*;
import  java.awt.event.*;
import  javax.swing.border.*;
import  java.sql.Connection;
import  java.sql.DriverManager;
import  java.sql.SQLException;
import  java.io.*;
import  java.util.Vector;

...

public class <the_main_class> {
....

public void connectDB( String DBName, String user,
String passwd )
{
...                
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (ClassNotFoundException cnfe) {
System.out.println("\nClassNotFoundException
occured");
System.out.println("connection with the DB is not
possible");
System.exit(ERROR);
}
.....
} //end of method

....
public static void main( String args[] ) {
........
}
} //end of main class

at execution, piece of code defined in the method
corpse:

Class.forName("com.mysql.jdbc.Driver").newInstance();

create exception: ClassNotFoundException

Before compiling, I set CLASSPATH variable as:

export
CLASSPATH='/usr/share/jdbc/mysql-connector-java-3 (See http://ava-3.ora-code.com).1.14-bin.jar'

then I compile with standard command:

javac *.java

and create jar executable with command:

jar cvfm runme.jar ./META-INF/MANIFEST.MF *.class

The sole way i found to solve path of Driver class is
to put directly in the jar executable content of class
files, i.e to extract the com directory (under current
location) from jdbc archive and then update runme.jar
by doing:

jar uvf runme.jar com

but this solution is unacceptable; I precise too that
when I  was working previously under another linux
distro (mandrake10) I didn't encounter this problem,
classes where found just by specifying classpath
value; this seems rather uncreadible even for me but
maybe have i forgot or uncorrectly set
something...well suggestions are welcome...Thank you
in advance

Michel

--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/java?unsub=mysql@(protected)