Posted By vibhu on July 8th, 2010

Netbeans is an IDE -a JavA editor provided by Sun Microsystem and it is open source (absolutely free!!)
From last few days i was having problem in my JDBC programming while connecting the ORACLE server to the Netbeans. But finally i have solved it by the help of my senior. But when i was surfing the solution on the internet,it is almost very difficult to search it on Google..and found some forums where where the same problem was discussed but no one tells the appropriate answer.. :( so i thought i should help my friends :) .
Generally in java we use only two database Oracle and Mysql,both vendor provides the jar files which contains classes for the jdbc-driver.I m going to describe both connectivity one by one . :)

ORACLE DATABASE


ORACLE DATABASE is very easy to install . I think you have already installed it i m just going to explain it’s connectivity with Netbeans

    First run the Netbeans IDE .and open the Service window..
    In service window click on Database expand it and the right click on the Driver ,then add new driver. It will demand for jar file .which is oracle14.jar browse it from C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\oracle14.jar
    Then right click on the database and then Add new connection it will pop-up a new window like below.:)

    You can fill the text boxes like shown in image or go to direct URL and paste this url jdbc:oracle:thin:@//localhost:1521/XE
    now click next and and then select the schema .. then OK. Now u will find a new driver by expanding the database. you simply right click on the driver and click connect ,it will ask for the password of the database then you can execute your sql command on the netbeans like this :

    Now it’s time for some jdbc programming , first to use sql queries in your programming you have to import oracle jdbc library to you library folder for this just Right click on the project library folder and then Add new Library, the oracle library will be not there you have to create it :( . for this go to create it will pop a window ,in name put oracle and select class library the add new jar file from C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\oracle14.jar then OK . library has been created select it and the the library will be added to your library folder.
    And to connect it from your program you have to put “jdbc:oracle:thin:@//localhost:1521/XE”; as your URL and “oracle.jdbc.OracleDriver” as your driver it’s simple :)

Now your Netbeans is ready Oracle Database Programming with JAVA

My SQL DATABASE


Now it’s turn for MySql database . it’s very simple to install and many of the student who learns database connectivity opt mysql as their database..is’t connectivity with Netbeans is very simple just few steps :)

    You don’t have to add new driver here ,it is provided by Netbeans. :) Just go to database the right click and add new connection a pop window show as below will appear: :)

    You can fill the boxes ,as shown in figure :) but first you have to create a database in your sql server. Or you cal select direct URL and put the following url jdbc:mysql://localhost:3306/dbforplacement(“dbforplacement” is my database name). Then click ok and it’s over .
    Now for JDBC programming you to Add mysql jdbc library to your library folder of your project for this just go to library right click on this and then Add new library .
    here you will find Mysql-jdbc library as netbeans provide it just add it and then ok :)
    Now in your program you have to use “jdbc:mysql://localhost:3306/dbforplacement”(“dbforplacement” is my database name) as the URL of the Database and “com.mysql.jdbc.Driver” as driver..

Now you are ready with MySql database server connected with Netbeans IDE to learn database programming in JAVA :)

you can comment below for your Queries.. ;)

Related posts

Tags: , , ,

Similar Posts

23 Responses to “Connecting DataBase to Netbeans IDE”

rajnish

gr8 effort keep it up………..

[Reply]

Paris Atkinson

I followed your instructions and it worked great! thanks!

[Reply]

vibhu Reply:

:) .

[Reply]

grants for single mothers

Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up

[Reply]

Laurena Crighton

Hello This is a great blog keep your good work and thank you for hvar in with me So nice to hear frome you.Thanks!

[Reply]

vibhu Reply:

thanx for appreciating :)

[Reply]

thesmok

I want to quote your post in my blog. It can?
And you et an account on Twitter?

[Reply]

vibhu Reply:

yes it is http://twitter.com/vibhuaddicted :)

[Reply]

rack

My cousin recommended this blog and she was totally right keep up the fantastic work!

[Reply]

evony like

Such a well written post.. Thnkx for sharing this post!

[Reply]

victoria

Dear admin, thnx for sharing this blog post. I found it wonderful. Best regards, Victoria…

[Reply]

rulett szistema

I cannot believe this will work!

[Reply]

paul

this post is very usefull thx!

[Reply]

jhon12

Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this.

[Reply]

dewani

This guided me to complete my work with fun :)

[Reply]

Backlinks

hey all, Keep up the good work. very informative, and love all the information provided. I love everything i have read so far :)

[Reply]

Myrna Juste

I just needed to say that I found your blog via Goolge and I am glad I did. Keep up the good work and I will make sure to bookmark you for when I have more free time away from the books. Thanks again!

[Reply]

Timika Semmens

somehow found your blog while searching for a article for a class, but I have to say I’m happy I found it …will definately browse more sometime.

[Reply]

Gaynelle Hammed

It\\\’s great right here. nice study. I\\\’ve been searched this advice for a little bit. thanks

[Reply]

peycho

I would like to exchange links with your site magicalharsh.com
Is this possible?

[Reply]

Larhonda Berzas

Very neat blog article.Really thank you! Want more.

[Reply]

baheti

Re: Oracle 10g connecting to IDE, I found the solution for my sql exception. I needed to include the jar in the Project library.

[Reply]

baheti

My problem is solved, I needed to add the driver jar file to the project library.

[Reply]

Leave a Reply