• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in Microsoft ODBC driver

 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>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
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic