my dog learned polymorphism*
The moose likes JDBC and the fly likes Exception in Microsoft ODBC driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Exception in Microsoft ODBC driver" Watch "Exception in Microsoft ODBC driver" New topic
Author

Exception in Microsoft ODBC driver

amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
the Exception thrown is

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index

Meaning of this type is? Is it common type exception?


thanks in advance

regards
amit bhadre


Thanks advance who ever answers this question.


regards
amit bhadre
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

The meaning of that exception would be much easier to determine if we could see the line of code that caused the exception to be thrown. Would you like to post it? Plus other lines of code that help to explain it.
amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
The code is as follows
class InterviewFeedBack{
public static void main(String[] args) {
InterviewFeedBack interviewback=new InterviewFeedBack();

interviewback.getDetails("189");

try {
interviewback.DateFunction("Patrick","2006-06-01","2006-06-30");
} catch (NullPointerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
public void getDetails(String CandidateID){
Connection connection=null;
ResultSet resultSet=null;
Statement statement=null;
CandidateInterviewDate =new ArrayList();
InterviewResult =new ArrayList ();
InterviewerName =new ArrayList ();
CandFeedBack =new ArrayList ();
candidateId=new ArrayList();
try {
connection=getConnection();
} catch (SQLException e) {

e.printStackTrace();
}
try{
statement = connection.createStatement();
resultSet=statement.executeQuery("select Candidate_id,Candidate_Interview_Date ,Candidate_Interview_Result,Candidate_Interviewer_Name,Candidate_Feedback from CANDIDATE_INTERVIEW_RECORD inner join cms_candidate on cms_candidate.cand_id = CANDIDATE_INTERVIEW_RECORD.candidate_id ");
System.out.println("The Result Set ="+resultSet);
while(resultSet.next())
{
System.out.println("I am enetering");
this.CandidateInterviewDate.add((String) resultSet.getString("Candidate_Interview_Date"));
this.InterviewResult.add((String)resultSet.getString("Candidate_Interview_Result"));
this.InterviewerName.add((String)resultSet.getString("Candidate_Interviewer_Name"));
this.CandFeedBack.add((String)resultSet.getString("Candidate_Feedback"));
this.candidateId.add((String)resultSet.getString("Candidate_id"));
System.out.println("I am leaving");
}
System.out.println(CandidateInterviewDate.size());
resultSet.close();
statement.close();
connection.close();
System.out.println("The arraylist from DB "+CandidateInterviewDate);
} catch (SQLException e) {
e.printStackTrace();
}
catch(NullPointerException e){
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
}


}


The Exception thrown is

sun.jdbc.odbc.JdbcOdbcConnection@201f9
The Result Set =sun.jdbc.odbc.JdbcOdbcResultSet@1ffb8dc
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at cms.history.candidate.InterviewFeedBack.getDetails(InterviewFeedBack.java:173)
at cms.history.candidate.InterviewFeedBack.main(InterviewFeedBack.java:195)
I am enetering
The Result Set =sun.jdbc.odbc.JdbcOdbcResultSet@dc840f
The arraylist from DB 0


Thanks in adavnce if you suggest me.I think the problem is with connection broker.java file.

I am alos trying to debug it.

regards
amit bhadre
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
>this.CandidateInterviewDate.add((String)resultSet.getString("Candidate_Interview_Date"));
>this.InterviewResult.add((String)resultSet.getString("Candidate_Interview_Result"));
>this.InterviewerName.add((String)resultSet.getString("Candidate_Interviewer_Name"));
>this.CandFeedBack.add((String)resultSet.getString("Candidate_Feedback"));
>this.candidateId.add((String)resultSet.getString("Candidate_id"));
Your staements are correct, but you can try:
this.CandidateInterviewDate.add(resultSet.getString(2));
this.InterviewResult.add(resultSet.getString(3));
this.InterviewerName.add(resultSet.getString(4));
this.CandFeedBack.add(resultSet.getString(5));
this.candidateId.add(resultSet.getString(1));

If it works normally, you can try http://jtds.sourceforge.net
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
use alias name for your table in query like this....

select t1.c11, t2.c21 from Table1 as t1 innerjoin Table2 as t2 on t1.c13=t2.c24

Naseem


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in Microsoft ODBC driver