473,671 Members | 2,601 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 1696

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

Similar topics

0
6261
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
2561
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
4240
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
8395
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
2430
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
2030
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
1
2517
by: paulq182 | last post by:
PLEASE HELP ME WITH MY CODE?? import java.sql.*; import java.io.*; class min_filmdb_rel_mysql { public static void main (String args ) throws SQLException, IOException {
1
3050
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
8485
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
8403
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
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
8677
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...
0
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6238
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
5704
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();...
1
2819
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
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.