Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting SQLException while executing merge query.

 
dhaval yoganandi
Ranch Hand
Posts: 35
Android Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error message is pretty informative. have you looked at that?
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Android Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Android Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry I couldn't remove that spaces..in previous post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic