473,732 Members | 2,207 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.Connec tion;
import java.sql.Driver Manager;
import java.sql.SQLExc eption;
import java.util.*;

class JdbcTest1 {

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

try{
Class.forName(" com.mysql.jdbc. Driver").newIns tance();
System.out.prin tln("Driver Registration Successful.");
} catch (InstantiationE xception ie){
System.out.prin tln("Class Instantiation Exception: " + ie);
} catch (ClassNotFoundE xception cnf){
System.out.prin tln("Class Not Found Exception: " + cnf);
} catch (IllegalAccessE xception iae){
System.out.prin tln("Illegal Access Exception: " + iae);
}

try {
// conn =
DriverManager.g etConnection("j dbc:mysql://localhost:3306/mysql?user=root &pas
sword=root");
java.sql.Connec tion conn =
DriverManager.g etConnection("j dbc:mysql:///mysql","root", "root");
System.out.prin tln("Connection to MySQL Database Successful");
} catch (SQLException sqe1){
System.out.prin tln("Caught SQL Exception: " + sqe1);
}

}

}

The output is

Driver registeration successful

java.lang.NoCla ssDefFound error
com/mysql/jdbc/Connection
at com.mysql.jdbc. NonRegisteringD river.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 2564

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

Similar topics

0
6268
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 pointing to "loginValidate.jsp" * a loginValidate.jsp page that references logic to validate requests * a loginBean class used to pass info between the JSP and validation logic * a usersDAO class used to perform lookups in a USERS
0
1698
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
4245
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 of MySQL 5.0? When trying to connect I am getting: ** BEGIN NESTED EXCEPTION **
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: CLASSPATH=c:\j2sdk1.4.2_04\jre\lib\ext\mysql-connector-java-3.0.14-production-bin.jar To test it I use this simple code (just to test if the Driver is loaded): //------------------------------------------------------------------ import java.sql.Connection;...
39
8422
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 of stammering and sputtering, and managed to pull out something I heard a couple of years back - that there was no real transaction safety in MySql. In flight transactions could be lost.
13
2440
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). I'm using the following JSP/JDBC code to do that. ---------------------------------------------------------------------------------------------- Class.forName ("com.mysql.jdbc.Driver").newInstance();
5
2040
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
1
3058
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 :http://localhost:8080/ProjetService/services/Magasin/getMagasins i done this error: echec pilote :java.lang.ClassNotFoundException: com.mysql.jdbc.Driver echec connection a la bdd :java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/boutiquegeographique erreur...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9307
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9181
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
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 we have to send another system
2
2721
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.