Click to See Complete Forum and Search --> : JDBC Trouble


Kishore Kumar
July 22nd, 1999, 06:06 AM
Hi,

We are using Oracle 8.0 and JDK 1.2.

While retrieving data through JDBC, from a table, a cryptic General error message is coming.

The table structure is :

Student_Name varchar2(10)
Student_id varchar2(5)
Books_issued Books

where Books is a nested table created from the Object Books_Type which has the following structure:

Books_id varchar2(5)
Author varchar2(10)
Title varchar2(10)
Issue_Date Date
Return_Date Date


The query :

select * from student;

works in SQL but not in JDBC.

But, queries like
select books_issued the(select books_issued from student )
or
select student_id from student

is working through JDBC.

The code in our java program is given below :

import java.sql.*;
import genins.dbconnect.*;

public class ORDMS
{
public static void main(String ar[])
{

ResultSet res ;
MDBConnect st = new MDBConnect();
try
{
res = st.executeQuery("select * from student ");
while(res.next())
{
System.out.println("inside next..");
System.out.println("Integer"+res.getString(1));
System.out.println(" "+res.getString(2));
System.out.println(" "+res.getString(3));
System.out.println(" "+res.getString(4));
System.out.println(" "+res.getString(5));
}
}
catch(SQLException e)
{
System.out.println("Exception ERROR"+e);
}
}
}


The Connectivity to the database is done through a java program in the package dbconnect.

After executing the above piece of code, only this particular SQL query is not executing and gives the cryptic message : General Error.

Please tell us whether it is possible to retrieve all the fields through a single SQL Query and how...

Regards,

JavaTeam.

Kishore Kumar D
Bangalore.
India.

rickyt
September 29th, 1999, 01:31 PM
There are some known Oracle jdbc bugs that generate 'weird' error messages. I've got similar but different problems with some code that I am creating here. Oracle tell me that the latest version of their jdbc drivers fixes these, and can be gotten from the download section of technet.oracle.com - note that I've not tried it yet so cannot say how well it works.

Rick