Connecting PostgreSQL to Netbeans – Part 2

This is the continuation of the previous tutorial I had, Connecting PostgreSQL to Netbeans – Part 1. Now, we will be accessing our database in PostgreSQL via our Netbeans platform.

Stretch your patience with this one, especially in the coding part.

1. As you open your Netbeans, got to File > New Project > Categories: Java > Projects: Java Application. Then click Next.

2.  Fill in your Project Name, then click Finish.

3.  Go to your project, mine is named trylang. Right click Libraries, and  Add Library.

4. A pop-up will appear, choose PostgreSQL JDBC Driver.

5. Then clear the source file and fill it with the code that will eventually connect your database to your Netbeans. The code can be downloaded in this file hosting site. Warning: you have to replace the variables in the code with your own in your database; it’s because it will surely cause errors.

6. Finally, after pasting and editing the code, Run the code. Then you will get a pop-up window displaying the content of your table you created in PostgreSQL.

There you have it, you’ve just accessed your database in PostgreSQL using Netbeans. You could actually edit the columns of your table, and rerun the source code. You will then get an updated call.

Domo arigato! XD

Connecting PostgreSQL to NetBeans – Part 1

This tutorial will explain about accessing one’s database using PostGreSQL and connecting it to NetBeans.

However, if you happen to have no PostGreSQL installed in your computer, you can download it and follow the installation instructions I have created. Also, do download NetBeans and Java SDK. You could actually download both Java SDK and NetBeans bundle at the same time here.

So, let’s start the agony!

1. As soon as you open your PostGreSQL, you will land to this page. Now, right click PostgreSQL localhost:5432.

2. Then key in postgres as password on the server (localhost).

3. Go to Databases > Postgres > Schemas > Public > Table. Right click the Table, and choose New Table.

4. You will get to the table pane. Name your table, and leave the other as blank.

5. Go to Columns, and click the Add button below.

6. This time, you will be adding the columns of your table. Type the name of your table. Fill the Data type as text. Check the box of Not NULL.

7. Keep on adding more columns until you reach your desired number of columns.

8. Then you need to go to Constraints, just beside the Columns.

9. Choose any column as a constraint, and add it. Then click OK.

10. Now, you need to go to the left sidebar. Go to Tables > the name of your table, mine is Author. Then, right click the named table, click Scripts > INSERT script

11. Fill the Values, in other term, populate your database. Replace the question marks with the entries enclosed in two apostrophes. Then execute the query by pressing the big green arrow button above. Save your work by closing the window.

12. Now, go back to your named table, mine is Author. Right click it, then go to View Data > View All Rows. A window will appear with the populated query. It means, you are successful!

Please read the Part 2 of this tutorial, I will be posting it as soon as possible. We will be connecting our database to NetBeans.

How to install PostGreSQL

Hey! This is my first tutorial. This post will discuss about installation of PostGreSQL. So, let’s get it started!

1. First stop, you have to download PostGreSQL.

2. After you run the application, just click the Next button.3. Then choose your Installation Directory and Data Directory, but you could select the default path just by clicking the Next button.

4. When you are prompted for Password, key in postgres and then retype the password.

5. Key in 5432 for the Port.

6. Just click the Next button for the Locale.

7. Then wait while the Setup installs.

8. Tadaaan! And you’re now finished installing your PostGreSQL. [Congrats! Pastel naman dyan.]

Old McDonald had a Farm in MSU

A music video which depicts the diverse environment inside the campus of Mindanao State University – General Santos City (MSU-GenSan).

A true proof of a human-animal symbiotic relationship; where students fall in line with the cows in the pathways, where students and goats share the same classrooms, and where students are second patrons in the comfort rooms after the snakes.

This is a project presentation in IT 123 – Multimedia Applications and Authoring Tools.

Location: MSU-GenSan Campus
Video Equipment: Sony Cybershot
Film Budget: None. (Artists were not paid for charity purposes)

CSI: Tambler

What is the life of a typical MSUan?

This documentary will be a response to this famous question of how does a student of Mindanao State University – General Santos City survive in such chaotic academe. A lot may know that MSU-GenSan always tops the National Board Exams, but seldom know the hardships that a MSUan treks towards this prestige. Let this documentary be an answer.

A project presentation in IT 123 – Multimedia Applications and Authoring Tools.

Location: MSU-GenSan Campus
Video Equipment: Cannon Digicam
Film Budget: 10 Pesos (For Pastil)

Tarpaulins

BURNING AT 100. With flaming athleticism and undying comradeship, the Inter-Collegiate Athletics Association (ICCA) is celebrating the festivities of its Centennial Age. Realizing the need for greater excellence in Sports, the ICAA continues its mission to spread the power of physical battle through various events.

Simultaneously, this year’s activities will be happening from the month of September until October at the heart of Araneta Center, Cubao, Quezon City. So, cheer loud and be proud!

REACH THE HEIGHTS. Get the chance to climb the world’s highest peak, the Mount Everest. Be at the top of the world on December 1, 2011 on the Tibetan Alps, Nepal.

WEDDING OF THE MOMENT. The long wait is going to end inside in the church. Witness the Tan-Lopez Nuptial.

CHEAP TOYS? Come and avail of imported toys at very reasonable price.