import java.sql.*;
import java.util.*;
class JoinTable
{
public static void main(String[] args) throws SQLException
{
try
{
Class.forName("sun.jdbc.odbc.jdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Sql","sa","password@123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select Booking_id , Customer_Name, RoomCatagory_id,Room_id, Checkin_Date, Checkout_Date, Tariff");
while (rs.next())
{
System.outlprintln("\n"+rs.getInt(1)+"\t"+rs.getInt(2)+"\t"+rs.getString(3)+"\t"+rs.getString(4)+
"\t"+rs.getString(5)+"\t"+rs.getString(6)+"\t"+rs.getString(7)+"\t"+rs.getInt(8)+);
}
con.close();
stmt.close();
}
catch(Exception e)
{
}
System.out.println("Records retreived successfully....");
}
}
import java.util.*;
class JoinTable
{
public static void main(String[] args) throws SQLException
{
try
{
Class.forName("sun.jdbc.odbc.jdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Sql","sa","password@123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select Booking_id , Customer_Name, RoomCatagory_id,Room_id, Checkin_Date, Checkout_Date, Tariff");
while (rs.next())
{
System.outlprintln("\n"+rs.getInt(1)+"\t"+rs.getInt(2)+"\t"+rs.getString(3)+"\t"+rs.getString(4)+
"\t"+rs.getString(5)+"\t"+rs.getString(6)+"\t"+rs.getString(7)+"\t"+rs.getInt(8)+);
}
con.close();
stmt.close();
}
catch(Exception e)
{
}
System.out.println("Records retreived successfully....");
}
}
No comments:
Post a Comment