473,513 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mysql jdbc driver problem

hello

I am trying to connect to mysql database using connector/J jdbc driver
this is my code

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.*;

class JdbcTest1 {

public static void main(String[] args) {
// Connection conn = null;
// Statement st = null;
//ResultSet rs = null;
//ResultSetMetaData rmd = null;
String query = null;

try{
Class.forName("com.mysql.jdbc.Driver").newInstance ();
System.out.println("Driver Registration Successful.");
} catch (InstantiationException ie){
System.out.println("Class Instantiation Exception: " + ie);
} catch (ClassNotFoundException cnf){
System.out.println("Class Not Found Exception: " + cnf);
} catch (IllegalAccessException iae){
System.out.println("Illegal Access Exception: " + iae);
}

try {
// conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql?user=root&pas
sword=root");
java.sql.Connection conn =
DriverManager.getConnection("jdbc:mysql:///mysql","root", "root");
System.out.println("Connection to MySQL Database Successful");
} catch (SQLException sqe1){
System.out.println("Caught SQL Exception: " + sqe1);
}

}

}

The output is

Driver registeration successful

java.lang.NoClassDefFound error
com/mysql/jdbc/Connection
at com.mysql.jdbc.NonRegisteringDriver.connect()

I am not able to figure out whether it is the URL problem to getConnection
or something else

please help

Jul 19 '05 #1
0 2538

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6250
by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action...
0
1690
by: sridhar nagabhurshana | last post by:
hello I am trying to connect to mysql database using connector/J jdbc driver this is my code import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException;
0
4231
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
637
by: Peter Höltschi | last post by:
I try to install MySQL Connection/J on a Windows XP box. MySQL on localhost works fine. But I cannot load the MySQL Connection/J Driver. The CLASSPATH variable is set like this:...
39
8367
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort...
13
2401
by: delram | last post by:
Hello All! I've been struggling with this problem for a while. I have a database from which I need to read and display some data on a browser. (The database is set up for remote access). ...
5
2020
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
1
3039
by: manjava | last post by:
Hello, i have a class java conncet to database mysql when i execute the classe alone so execute but when i want to execute this link on web...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.