Download and Install Spring Tool Suite

Create a Maven Project

Run Spring Tool Suite

New -> Maven -> Maven Project

Select the default quickstart archetype

org.apache.maven.archetypes maven-archetype-quickstart

Enter a Group Id and Artifact Id for the app:

Group Id: com.skills421.jdbc

Artifact Id: jdbcExample

Edit Pom.xml

<project xmlns="" xmlns:xsi=""






package com.skills421.jpa.jdbcExample;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

 * Hello world!
public class App
    public static void main( String[] args )
    throws ClassNotFoundException, SQLException

	String url = "jdbc:postgresql://localhost/jdtest";
	Properties props = new Properties();

	Connection conn = DriverManager.getConnection(url, props);

	// make sure autocommit is off

	Statement st = conn.createStatement();

	// Turn use of the cursor on.

	ResultSet rs = st.executeQuery("SELECT * FROM person);

	ResultSetMetaData rsmd = rs.getMetaData();

	while (
	   for(int i=1; i <= rsmd.getColumnCount(); i++)
	       System.out.println(rsmd.getColumnName(i) + " = " + rs.getObject(i));



name = John Dunning
age = 21
height = 1.80

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s