
import java.sql.*;
public class Tyagi
{
public static void main (String args[])throws SQLException
{
ResultSet rs;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:8080:oracle", "System", "manager");
Statement st = conn.createStatement();
rs=st.executeQuery("Select * from student");
while(rs.next())
System.out.println(rs.getString(1));
st.close();
conn.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.