From: John B. Matthews on
In article
<281f3818-4222-4bdf-bfb9-0011bfdbbf84(a)k2g2000pro.googlegroups.com>,
sangeeta chowdhary <sangitachowdhary(a)gmail.com> wrote:

> On Mar 2, 11:44 am, Lew <no...(a)lewscanon.com> wrote:
> > sangeeta chowdhary wrote:
> > >>> hey m writing program in java to connect it to mysql.
> > >>> I have given driver name as
> > >>> Class.forName("com.mysql.jdbc.Driver");
> > >>> but i [sic] am getting  ClassNotFoundException.
> > >>> Please help me what shall i do.
> > Mike Schilling wrote:
> > >> Ensure that the jar containing the class com.mysql.jdbc.Driver
> > >> is in  your classpath.
> > sangeeta chowdhary wrote:
> > > Thank you sir for your reply.
> > > i have set user variable as mysql and value of this variable is
> > > xampp/ mysql/bin/mysql.exe
> >
> > You do not need to do that.
> >
> > > what else i need to do?
> >
> > You need to study about the Java classpath and JAR files.  You need
> > to download the MySQL JDBC JAR file if you have not already done
> > so.  You need to include that JAR file in the classpath for your
> > Java program.
> >
> > <http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html>
> > <http://java.sun.com/docs/books/tutorial/essential/environment/paths.html>
>
> Please tell me full procedure to sort out this problem. i will be
> very thankful to you. i have set classpath to mysql connector also.
> still things are not working. kindly help me please.

After reading the tutorial, try something like this, adapted from the
documentation included with the driver:

public class LoadDriver {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
    }
}

On my platform, I'd do this:

$ ls mysql-connector-java-5.1.12-bin.jar
mysql-connector-java-5.1.12-bin.jar
$ javac LoadDriver.java
$ java -cp mysql-connector-java-5.1.12-bin.jar:. LoadDriver

If you're using Windows, you need to use ';' as the path separator, as
discussed in the second link provided by Lew.

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: Lew on
sangeeta chowdhary wrote:
>>> i [sic] have set user variable as mysql and value of this variable is xampp/
>>> mysql/bin/mysql.exe

Lew wrote:
>> You do not need to do that.

sangeeta chowdhary wrote:
>>> what else i [sic] need to do?

Lew <no...(a)lewscanon.com> wrote:
>> You need to study about the Java classpath and JAR files. You need to
>> download the MySQL JDBC JAR file if you have not already done so. You need to
>> include that JAR file in the classpath for your Java program.
>>
>> <http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html>
>> <http://java.sun.com/docs/books/tutorial/essential/environment/paths.html>

sangeeta chowdhary wrote:
> Please tell me full procedure to sort out this problem.

We already did. Read the links.

> i [sic] will be very thankful to you.

Really? Why not already?

> i [sic] have set classpath to mysql [sic] connector also.
> still things are not working.

What *precisely* did you do? Copy and paste (!) your commands, please.
Describe *exactly* what "not working" means - what did you do, what did you
expect, and what happened instead? Please be specific. Cite exact error
messages if you got any. Vague hand-waving does not empower useful answers.

Have you read the links?

Don't demand that we do all your work for you when you don't even provide
enough information to hint at what your difficulty is, haven't used the
information already provided, and haven't even expressed gratitude for the
help so far. This is a discussion group, not a help desk or unpaid outsource
software shop.

--
Lew
From: sangeeta chowdhary on
On Mar 2, 9:11 pm, Lew <no...(a)lewscanon.com> wrote:
> sangeeta chowdhary wrote:
> >>> i [sic] have set user variable as mysql and value of this variable is xampp/
> >>> mysql/bin/mysql.exe
> Lew wrote:
> >> You do not need to do that.
> sangeeta chowdhary wrote:
> >>> what else i [sic] need to do?
> Lew <no...(a)lewscanon.com> wrote:
> >> You need to study about the Java classpath and JAR files.  You need to
> >> download the MySQL JDBC JAR file if you have not already done so.  You need to
> >> include that JAR file in the classpath for your Java program.
>
> >> <http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html>
> >> <http://java.sun.com/docs/books/tutorial/essential/environment/paths.html>
> sangeeta chowdhary wrote:
> > Please tell me full procedure to sort out this problem.
>
> We already did.  Read the links.
>
> > i [sic] will be very thankful to you.
>
> Really?  Why not already?
>
> > i [sic] have set classpath to mysql [sic] connector also.
> > still things are not working.
>
> What *precisely* did you do?  Copy and paste (!) your commands, please.
> Describe *exactly* what "not working" means - what did you do, what did you
> expect, and what happened instead?  Please be specific.  Cite exact error
> messages if you got any.  Vague hand-waving does not empower useful answers.
>
> Have you read the links?
>
> Don't demand that we do all your work for you when you don't even provide
> enough information to hint at what your difficulty is, haven't used the
> information already provided, and haven't even expressed gratitude for the
> help so far.  This is a discussion group, not a help desk or unpaid outsource
> software shop.
>
> --
> Lew

Thank you sir