Hi to all, Im going through JDBC currently, I got struck with Java.lang.ArrayIndexOutofBounds Exception:0. I'm not getting the solution to this exception. Please help me to solve this exception, thanks in advance.
import java.sql.*;
class Select
{
public static void main(String args[])
{
try
{
Class.forName("jdbc.oracle.driver.OracleDriver");
Connection con = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","manager");
Statement stmt = con.createStatement();
ResultSet rs=stmt.executeQuery("select * from Student");
ResultSetMetaData rm = rs.getMetaData();
int n =rm.getColumnCount();
for(int i =1; i<=n; i++)
{
System.out.print(rm.getColumnName(i)+"\t");
}
System.out.println();
while(rs.next())
{
System.out.print(rs.getInt("rno")+"\t");
System.out.print(rs.getString("name")+"\t");
System.out.print(rs.getInt("marks"));
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}