import java.sql.*;
class JdbcDemo 
{
	Connection con;
	Statement stmt;
	ResultSet rs;
	public JdbcDemo()
	{
		try
		{
			Class.forName("org.postgresql.Driver");
			con=DriverManager.getConnection("jdbc:postgresql:postgres","postgres","postgres");
			stmt=con.createStatement();
			rs=stmt.executeQuery("select * from doctor");
			while(rs.next())
			{
				System.out.println("no    "+rs.getString(1));
				System.out.println("name  "+rs.getString(2));
				System.out.println("addr  "+rs.getString(3));
				System.out.println("city  "+rs.getString(4));
				System.out.println("area  "+rs.getString(5));
			}
			rs.close();
			stmt.close();
			con.close();
		}
		catch(ClassNotFoundException cnfe)
		{
			System.out.println(" Exception geneated "+cnfe);
		}
		catch(SQLException sqe)
		{
			System.out.println(" Exception geneated "+sqe);
		}
		catch(Exception e)
		{
			System.out.println(" Exception geneated "+e);
		}
	}
	
	public static void main(String args[])
	{
		JdbcDemo j=new JdbcDemo();
	}
}
