Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Error: Anyone know what's up??

 
Mike Stead
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Anyone know what this error means, and how to fix it?
Error java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Query is too complex.

Does it mean that the query can only be a certain size? I'm kinda new to this, so any help would be greatly appreciated.
Thanks!
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've had that happen to me before with Access. Unless you are truely doing a very complex query (Access does have its limitations), I would double-check the grammar of your query. When I got the error before it was usually because of something I missed or did wrong in the query. i.e. although it was syntactically correct, a missing operand/join/etc made the query appear too complex to Access.
 
Michael Matola
whippersnapper
Ranch Hand
Posts: 1817
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the query work when you run it in Access?
If not, consider posting the SQL here. If you do, it might be helpful to have some details about the tables: primary key fields, table relationships, etc.
 
Juanjo Bazan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd bet is not your java code.
That 'complexity' of the query is determined by the SQL engine you are using.
The problem is reported by MS here and some workarounds are provided...
-HTH
Juanjo
 
Mike Stead
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all you help... The database is an MS-Access. So the previous post makes sence... except that the UPDATE doesn't exceed the limitations mentioned. I'll post my code to see if anyone knows or can spot anything wrong.
final public boolean addReport(Report aReport)
{
try
{
String add_rep = "INSERT INTO Report_Table (Day, Month, Year, Area, Type," +
" Method, Comments, Gas, Materials, RockSamples," +
" StreamSamples, SoilSamples, Tony, Peter, Pat, Karl) " +
"VALUES (" +
aReport.getDay() + ", " +
aReport.getMonth() + ", " +
aReport.getYear() + ", '" +
aReport.getArea() + "', '" +
aReport.getType() + "', '" +
aReport.getMethod() + "', '" +
aReport.getComments() + "', " +
aReport.getGas() + ", '" +
aReport.getMaterials() + "', " +
aReport.getNumRockSamples() + ", " +
aReport.getNumStreamSamples() + ", " +
aReport.getNumSoilSamples() + ", " +
aReport.getTonyValue() + ", " +
aReport.getPeterValue() + ", " +
aReport.getPatValue() + ", " +
aReport.getKarlValue() + ")";
System.out.println(add_rep);
stmt.executeUpdate(add_rep);
}
catch (SQLException e)
{
System.out.println( "Error " + e );
return false;
}
return true;
}
Thanks again for your help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic