-2

I'm making a simple JDBC program in java SE 7 but after compiling program it's giving "java.lang.ClassNotFoundException: org.postgreasql.Driver" error i followed this link http://docs.oracle.com/javase/7/docs/technotes/guides/jdbc/ but not getting yet so please help.

7
  • please provide your code here? Commented Oct 4, 2013 at 11:07
  • 1
    You need to include the postgres JDBC driver in the classpath. Commented Oct 4, 2013 at 11:08
  • Iren: here is my source code.. pastebin.com/iiSsSDPZ Commented Oct 4, 2013 at 11:11
  • 1
    perhaps because there is no postgreasql driver? Commented Oct 4, 2013 at 11:11
  • I believe its not a compile time error, but it occurs at runtime! Commented Oct 4, 2013 at 11:13

6 Answers 6

5

possibly you may not be setting the path of jdbc driver follow the steps

  1. Right click on your project
  2. click buildpath->configure Build Path
  3. click libraries tab
  4. Click add external jars and give the path of driver
Sign up to request clarification or add additional context in comments.

3 Comments

@AnubhavSharma which IDE you are using?
@SpringLearner You are the man ,it worked ,thank you
@sg28 you are welcome
4

This:

org.postgreasql.Driver

should likely be

org.postgresql.Driver

Comments

1

THe name of the driver is wrong also. Should be org.postgresql.Driver iso org.postgreasql.Driver. So maybe a typo in your java code where you do Class.forname()

Comments

1

You would have to add the JAR file to your classpath for org.postgresql.Driver, You can download it from HERE .

2 Comments

i downloaded now how to set?
@AnubhavSharma See this LINK to add jar file then clean and built (7 ways).
1

You have to add the jdbc jar file on your build path. Firstly you have to download the jar from the link you provided. Then add it to build path. If you use eclipse: Right click on your project at the package explorer->Configure Build Path->Libraries->Add external jar->select your jar.

1 Comment

The path is the location of your jar file. If you download it usually goes to Downloads folder or the file you chose to download files with browser.
0

Please check your connection String url or connection driver and run code.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.