aspose file tools*
The moose likes JDBC and the fly likes Getting SQLException while executing merge query. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting SQLException while executing merge query. " Watch "Getting SQLException while executing merge query. " New topic
Author

Getting SQLException while executing merge query.

dhaval yoganandi
Ranch Hand

Joined: Jun 06, 2009
Posts: 35

Hi guys,

I am getting following exception while executing merge query in mysql 3.2. I am using embedded java library called mysql-je. Its an open source project (http://mysql-je.sourceforge.net/).


EXCEPTION IN RESULTSET WRAPPER WHILE EXECUTING QUERY: java.sql.SQLException: All tables in the MERGE table are not identically definedjava.sql.SQLException: All tables in the MERGE table are not identically defined
at com.mysql.embedded.api.api.mysql_real_query(Native Method)
at com.mysql.embedded.jdbc.MyStatement.execute(MyStatement.java:207)
at com.mysql.embedded.jdbc.MyStatement.executeQuery(MyStatement.java:75)


Thanks in advance,
dhaval.


a.k.a stalker.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'm guessing your table definitions are not identical. From the MySQL manual:

You cannot merge MyISAM tables in which the columns are listed in a different order, do not have exactly the same columns, or have the indexes in different order


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

the error message is pretty informative. have you looked at that?
dhaval yoganandi
Ranch Hand

Joined: Jun 06, 2009
Posts: 35

David O'Meara wrote:the error message is pretty informative. have you looked at that?


Yes I did search for that but I found no solution. They all were talking about incompatible engine type and datatype. But I've all tables created with MyISAM.

@Paul Sturrock

Alright, thanks for the info. I read that but it was working fine with the original mysql daemon. I've just copied the whole database from another location. Do you have anything in mind that can be solve this problem.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

It seems pretty clear that the tables are not identical. Could you post the DDL for each table so we can compare them?
dhaval yoganandi
Ranch Hand

Joined: Jun 06, 2009
Posts: 35

Tim McGuire wrote:It seems pretty clear that the tables are not identical. Could you post the DDL for each table so we can compare them?


Yeah sure.. Here it is..

Both the table has the following schema.. Because the tables are automatically made from a script. There is only difference in name of the table. They both have date as postfix.

Field Type Null Key Default Extra
url varchar(26) YES MUL null
accesstime datetime YES MUL null
hits int(11) YES null
datatransfer int(11) YES null

dhaval yoganandi
Ranch Hand

Joined: Jun 06, 2009
Posts: 35

sorry I couldn't remove that spaces..in previous post.
 
 
subject: Getting SQLException while executing merge query.