Thread: Problem loading driver
I try to load the jdbc driver by the following code : Class.forName("org.postgresql.Driver"); but I raise a ClassNotFoundException. But my CLASSPATH contains the postgresql-8.1-405.jdbc3.jar Any ideas ? Best regards ********************************************************************* Ce message et toutes les pièces jointes (ci-après le "message") sont établis à l'intention exclusive de ses destinataireset sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatementl'expéditeur. Toute utilisation de ce message non conforme à sa destination, modification, diffusion ou toutepublication, totale ou partielle, est interdite, sauf autorisation expresse.FININFO (et ses filiales) décline(nt) touteresponsabilité au titre de ce message, dans l'hypothèse ou il aurait été modifié, altéré, falsifié ou encore édité oudiffusé sans autorisation. ----------------------------------------------------- This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. Neither FININFO (nor any of its subsidiaries or affiliates) shall be liable for the message if modified, altered, falsified, edited or diffused without authorization. **********************************************************************
Hi Maignan, How do you run your program? Have you tried with the -cp commandline parameter? MAIGNAN Luc wrote: > I try to load the jdbc driver by the following code : > > Class.forName("org.postgresql.Driver"); > > > but I raise a ClassNotFoundException. > > But my CLASSPATH contains the postgresql-8.1-405.jdbc3.jar > > > Any ideas ? > > Best regards > > > ********************************************************************* > Ce message et toutes les pièces jointes (ci-après le "message") sont établis à l'intention exclusive de ses destinataireset sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatementl'expéditeur. Toute utilisation de ce message non conforme à sa destination, modification, diffusion ou toutepublication, totale ou partielle, est interdite, sauf autorisation expresse.FININFO (et ses filiales) décline(nt) touteresponsabilité au titre de ce message, dans l'hypothèse ou il aurait été modifié, altéré, falsifié ou encore édité oudiffusé sans autorisation. > ----------------------------------------------------- > This message and any attachments (the "message") is intended > solely for the addressees and is confidential. If you receive this > message in error, please delete it and immediately notify the > sender. Any use not in accord with its purpose, any dissemination > or disclosure, either whole or partial, is prohibited except formal > approval. Neither FININFO (nor any of its subsidiaries or affiliates) > shall be liable for the message if modified, altered, falsified, edited > or diffused without authorization. ********************************************************************** > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Mads N. Vestergaard | Standard Sys Admin Answer #112: http://rwxr-xr-x.dk | "Well, it works for me."
Please, please, please, search the archives before posting. I absolutely guarantee that your classpath is not correct, or you are running with -jar which negates the classpath. Show me your classpath *exactly* as it is, as well as the command line you are using. or try java -verbose <your command line> to see what is going on Cheers, Dave On 10-May-06, at 8:05 AM, MAIGNAN Luc wrote: > I try to load the jdbc driver by the following code : > > Class.forName("org.postgresql.Driver"); > > > but I raise a ClassNotFoundException. > > But my CLASSPATH contains the postgresql-8.1-405.jdbc3.jar > > > Any ideas ? > > Best regards > > > ********************************************************************* > Ce message et toutes les pièces jointes (ci-après le "message") > sont établis à l'intention exclusive de ses destinataires et sont > confidentiels. Si vous recevez ce message par erreur, merci de le > détruire et d'en avertir immédiatement l'expéditeur. Toute > utilisation de ce message non conforme à sa destination, > modification, diffusion ou toute publication, totale ou partielle, > est interdite, sauf autorisation expresse.FININFO (et ses filiales) > décline(nt) toute responsabilité au titre de ce message, dans > l'hypothèse ou il aurait été modifié, altéré, falsifié ou encore > édité ou diffusé sans autorisation. > ----------------------------------------------------- > This message and any attachments (the "message") is intended > solely for the addressees and is confidential. If you receive this > message in error, please delete it and immediately notify the > sender. Any use not in accord with its purpose, any dissemination > or disclosure, either whole or partial, is prohibited except formal > approval. Neither FININFO (nor any of its subsidiaries or affiliates) > shall be liable for the message if modified, altered, falsified, > edited > or diffused without authorization. > ********************************************************************** > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that > your > message can get through to the mailing list cleanly >
Hi Maignan,
man java, will tell you what the -cp does....
" -classpath classpath
-cp classpath
Specifies a list of directories, JAR archives, and ZIP archives
to search for class files. Class path entries are separated by
colons (:). Specifying -classpath or -cp overrides any setting
of the CLASSPATH environment variable.
If -classpath and -cp are not used and CLASSPATH is not set, the
user class path consists of the current directory (.)."
Also please keep all mails on-list.
Try it, as Dave mentioned it probably is a problem with your CLASSPATH.
Try to give us the ouput of `echo $CLASSPATH`.
MAIGNAN Luc wrote:
No I just do : java MyClass What does the -cp do ? -----Message d'origine----- De : Mads N. Vestergaard [mailto:mnv@timmy.dk] Envoyé : mercredi 10 mai 2006 14:04 À : MAIGNAN Luc Cc : pgsql-jdbc@postgresql.org Objet : Re: [JDBC] Problem loading driver Hi Maignan, How do you run your program? Have you tried with the -cp commandline parameter? MAIGNAN Luc wrote:I try to load the jdbc driver by the following code : Class.forName("org.postgresql.Driver"); but I raise a ClassNotFoundException. But my CLASSPATH contains the postgresql-8.1-405.jdbc3.jar Any ideas ? Best regards ********************************************************************* Ce message et toutes les pièces jointes (ci-après le "message") sont établis à l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa destination, modification, diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse.FININFO (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l'hypothèse ou il aurait été modifié, altéré, falsifié ou encore édité ou diffusé sans autorisation. ----------------------------------------------------- This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. Neither FININFO (nor any of its subsidiaries or affiliates) shall be liable for the message if modified, altered, falsified, edited or diffused without authorization. ********************************************************************** ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
--
Mads N. Vestergaard | Standard Sys Admin Answer #112: http://rwxr-xr-x.dk | "Well, it works for me."