File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Error: Anyone know what Watch "JDBC Error: Anyone know what New topic
Author

JDBC Error: Anyone know what's up??

Mike Stead
Greenhorn

Joined: Sep 27, 2002
Posts: 7
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

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
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1740
    
    2
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...
-HTH
Juanjo
Mike Stead
Greenhorn

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)
{
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!
 
 
subject: JDBC Error: Anyone know what's up??
 
Similar Threads
Connection reset by peer error
query works in SQL server but not Access :'(
Microsoft Access Store Query
microsoft access driver
whats faster - test for identity vs. (cast + booleanValue())