File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC Error: Anyone know what's up?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC Error: Anyone know what Watch "JDBC Error: Anyone know what New topic

JDBC Error: Anyone know what's up??

Mike Stead

Joined: Sep 27, 2002
Posts: 7
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.
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
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.

Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Michael Matola
Ranch Hand

Joined: Mar 25, 2001
Posts: 1792
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

Joined: Feb 04, 2002
Posts: 231
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...
Mike Stead

Joined: Sep 27, 2002
Posts: 7
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)
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() + ")";
catch (SQLException e)
System.out.println( "Error " + e );
return false;
return true;
Thanks again for your help!
subject: JDBC Error: Anyone know what's up??
It's not a secret anymore!