jdbc_netbeans

Configuring JDBC on Netbeans on Ubuntu 12.04

This is my first, to do, geeky post, hope this should help you all. To start with, I have two systems, a Core i5 desktop running Windows 7 (64 bit) and an Atom Net book running Windows 8 + Ubuntu 12.04. I had been trying Servlet program on my desktop and it worked fine until I had to add database connectivity to it. I had Oracle 10g installed on my desktop but wasn’t able to get the database connected.

But things were working just fine on my net book(Ubuntu) I prefer Ubuntu for programming for the sole reason that setting up things on it is easy and quick ! As we are using Netbeans IDE at our college, I first installed it on Ubuntu. (You can download it from here and choose Linux(x64/x86) version)

Here are some steps to configure JDBC on Netbeans on Ubuntu. Once you download the .sh file, simply open terminal and type the following :

sudo chmod +x netbeans-*
sudo ./netbeans-*

Once done with this, a GUI wizard will start and will guide you for the rest of the setup. Setup again was a breeze and require minimum number of clicks. Once the installation is done, it’s time to configure JDBC.

I’m using the MySQL Database for this. I had been using JDBC in swings previously. Now open NetBeans and create a new Application. Choose Java Web –> Web Application. Now you will see a list of files in the left pane. Right click on your project name –> Properties. Also, to add new files like .html, servlet etc choose New from the same menu.

Right Click Project Name --> Properties
Right Click Project Name –> Properties

 

Now select Library –> Add Library. Now look for MySQL JDBC Driver. Select that driver and add.

Select MySQL Driver from Add Library menu.
Select MySQL Driver from Add Library menu.

Click OK and run your program. I hope you don’t need the program now ! Below is a screenshot of how records from database will be displayed once the JDBC has been configured.

Sample Servlet Program using JDBC.
Sample Servlet Program using JDBC.

As you saw, this was a very simple task. Once you spend this small amount of time, things will be much simpler. Hope this post helps you !

Happy Coding !

About Atulmaharaj

A seasoned blogger and a content marketer for close to a decade now. I write about Food, Technology, Lifestyle, Travel, and Finance related posts. Blogging brings me joy and the best part is I get to read and e-meet so many amazing bloggers! PS: I'm also the founder for Socialmaharaj.com :) Favorite Quote: "Traveling is like reading a book, one who hasn't traveled, hasn't turned a page.

Check Also

How to create a Custom Google Form

How To Create Custom Google Form – A Step-by-Step Guide

Google has expanded its portfolio massively in the last few years. Gmail is now just …

Share your thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.