The Artima Developer Community
Sponsored Link

Java Answers Forum
connection java application to MySQL Database

4 replies on 1 page. Most recent reply: Dec 29, 2005 11:50 PM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
albert sie

Posts: 2
Nickname: albert85
Registered: Dec, 2005

connection java application to MySQL Database Posted: Dec 22, 2005 6:00 PM
Reply to this message Reply
Advertisement
I found the problem to build up a connection between the java application to MySQL
i need to develop a java program and retrieve the data inside the MySQL. to perform this i need make some configuration and set up is it? i want to know what i should download to built the connection.

i try to run the application program that i develop
the error message:
Unreported exception java.lang.class NotFoundException must be caught ar declared to be thrown.

what the problem is this???


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: connection java application to MySQL Database Posted: Dec 22, 2005 10:45 PM
Reply to this message Reply
That might be thrown when you're trying to load your Driver.
Ensure that all your Jars being used are set in the Classpath.

Though it would help if you posted the section of code that
throws the Error.

But as stated in most JDBC apps. this error is usually
thrown if the Jar File for the Driver is not set properly.

A google for MySQL JDBC driver should tell you what Jar
to use, if you already have the Jar Point your class path
to it.

In Linux:

export CLASSPATH=$CLASSPATH:./:your-mySQL-driver.jar

In Windows:

set CLASSPATH=%CLASSPATH%;./;your-mySQL-driver.jar

Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: connection java application to MySQL Database Posted: Dec 23, 2005 5:43 AM
Reply to this message Reply
Are you seeing that error when running? Or when compiling the application?

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: connection java application to MySQL Database Posted: Dec 23, 2005 6:46 AM
Reply to this message Reply
> Are you seeing that error when running? Or when compiling
> the application?

Mr Parks:

That's a very odd question. The only time that error gets
thrown is when the JVM is up and running. i.e. it can only
be a run time error. It is thrown when the *application*
(which should have been compiled if its going to try and
load the class) tries to load a class via its class name
(passed in as a String) and fails.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: connection java application to MySQL Database Posted: Dec 29, 2005 11:50 PM
Reply to this message Reply
There are only 2 possibilities.

1. The class name is wrong
2. You didn't include the drivers jar file in your classpath

Please post the String with the class name

Flat View: This topic has 4 replies on 1 page
Topic: Truncation in soap response message Previous Topic   Next Topic Topic: JSF <h:selectOneListBox>

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use