• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please clear me to display

 
ramchander yshetti
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai
please clear me how to display this object

/*
create type address_a as object
(street varchar2(10),
city varchar2(10));

-----

create table student
(sno number(3),
sname varchar2(10),
address address_a);

-------
insert into student values(1,'ramr',address_a('ss','dde'))
insert into student values(2,'ramchander',address_a('ds','dde'))
----
*/

import java.sql.*;
import java.io.*;
public class Demo
{
public static void main(String arg[]) throws Exception
{

Driver d=new sun.jdbc.odbc.JdbcOdbcDriver();

DriverManager.registerDriver(d);

Connection con=DriverManager.getConnection("jdbcdbc:myemp","scott","tiger");

System.out.println("Catalog : "+con.getCatalog());
Statement st=con.createStatement();


ResultSet rs=st.executeQuery("select sno,sname,address from student");
while(rs.next())
{
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
byte b[]=rs.getBytes(3);

for(int i=0;i<b.length;i++)
System.out.println(b[i]);


}

}
}

RUNTIME ERROR

Exception in thread "main" java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:2
53)
at Demo.main(Demo.java:34)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic