facebook

No Foreign Keys Soow Up

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #275138 Reply

    fenbers
    Member

    I just upgraded to MyEclipseIDE on my Mac. I used your tutorial to create some foreign keys among a few tables. Generating DDL on the tables reveals the SQL that creates the foreign key constraints. In the

    Indexes

    tab of the

    Table/Object Info

    window, they appear, but in the

    Foreign Keys

    tab, they do not. Why not? Also, nothing in the Entity-Relationship diagram indicates no foreighn keys (i.e., no icons, not any blue lines connecting tables).

    I took a peek at the DB from outside of Eclipse (using a browser-based PHPmyAdmin). This utility shows some of my foreign keys, but not all.

    What am I doing incorrectly?

    Mark

    #275142 Reply

    Loyal Water
    Member

    What version of MyEclipse are you using ? What tutorial are you following ?

    #275154 Reply

    fenbers
    Member

    Using MyEclipse 6.0, and whatever tutorial version was posted last night on the myeclipseide.com website. I assume this was for v6 also, because adding the foreign keys behaved exactly as the tutorial showed.

    Mark

    #275199 Reply

    fenbers
    Member

    More info.

    I tried this again just now, and after creating two new foreign key constraints, the regenerated DDL for the table shows that just regular indexes were created instead of foreign key data, like this: (Hopefully the backticks won’t cause a problem when this is posted…)

    create table `pepdatabase`.`Alternates`(
    `altid` int unsigned not null auto_increment,
    `cid1` int unsigned default ‘0’ not null,
    `cid2` int unsigned default ‘0’ not null,
    primary key (`altid`)
    );

    create unique index `PRIMARY` on `pepdatabase`.`Alternates`(`altid`);
    create index `alternates_cid1_fk` on `pepdatabase`.`Alternates`(`cid1`);
    create index `alternates_cid2_fk` on `pepdatabase`.`Alternates`(`cid2`);

    Mark

    #275203 Reply

    fenbers
    Member

    I have been able to solve this on my own. It turns out that MySQL cannot have foreign key constraints with the myISAM engine — only with the InnoDB engine. So for any tables that define foreign keys or are the target of them, they first have to be converted to InnoDB type tables, first. Then, foreign keys are able to be created…
    Mark

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: No Foreign Keys Soow Up

You must be logged in to post in the forum log in