Java Program to Connect Database using JDBC API

import java.sql.*;
class Test
{
  public static void main(String args[]) throws SQLException
{
    try{
         Class.forName("sun.Jdbc.OdbcDriver");
       } catch(ClassNotException e) {};
     Connection conn;
     Statement stmt;
     ResultSet rs;
     String op="jdbc:odbc:JavaTest";
     conn=DriverManager.getConnection(op, "Admin", "");
     stmt=conn.createStatement();
     String sql;
     sql="SELECT *FROM SupplierMaster"+"WHERE SupplierCode IN("+"SELECT SCode"+"FROM Relation"+"WHERE PCode IN("+"SELECT ProductCode"+"FROM ProductMaster"+"WHERE ProductCatg IN("+"SELECT CatgID"+"FROM CategoryMaster"+"WHERE CategoryName='Eatables')))";
     rs=stmt.executeQuery(sql);
     System.out.println(" "+"Sup Code"+" "+"Sup Name"+" "+"Sup Address");
     System.out.println("___________________________________________");
     String name, add;
     int code;
     while(rs.next())
      {
        code=rs.getInt("SupplierCode");
        name=rs.getString("SupplierName");
        add=rs.getString("SupplierAddress");
        System.out.println(" "+code+" "+name+" "+add);
      }
  }
}