TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mysql_comp.jar part II
this is the oddest thing, my thing about mysql_comp.jar, ok, the .jar
file looked right and is right becuase I ran some other programs that
use it and they work. Is there some way that something could have been
overwritten/changed so that my current program will not work? Because
there are 3 classes I used for my one app and none of them work, they
all get the class not found error for mysql_comp.jar. I even whacked the
code from teh programs that work for teh part that connects with the
database.
Here is some sample code:
import java.sql.*;
import java.util.*;
public class Foo {
private Connection connection;
private Statement statement;
// constructor that makes a connection to the DB
public Foo () {
String url = "jdbc:mysql://foobar";
String username = "hmmm";
String passwd = "hmmmm";
try {
Class.forName("org.gjt.mm.mysql.Driver");
connection = DriverManager.getConnection(url, username,
passwd );
statement = connection.createStatement();
}
catch ( ClassNotFoundException cnfex ) {
System.err.println(
"Failed to load JDBC/ODBC driver." );
cnfex.printStackTrace();
System.exit( 1 ); // terminate program
}
catch ( SQLException sqlex ) {
System.err.println( "Unable to connect" );
sqlex.printStackTrace();
}
} // end of no arg constructor
--
Erick Stohr - PageLab Network, Inc.
mailto:erick@pagelab.net http://pagelab.net
Your search-to-sale global e-commerce solution!
Toll free 1-800-447-0607
Voice 612-362-9224
Fax 612-362-9227
43 Main Street SE, Suite 228
Minneapolis, Minnesota 55414