Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 150422 - Sample DB can't be created without InnoDB
Sample DB can't be created without InnoDB
Status: VERIFIED FIXED
Product: db
Classification: Unclassified
Component: MySQL
6.x
All All
: P2 (vote)
: 6.x
Assigned To: David Vancouvering
issues@db
65fixes1-verified
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-16 17:00 UTC by Roman Mostyka
Modified: 2008-12-11 22:30 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
Log file of NetBeans. (144.17 KB, text/plain)
2008-10-16 17:04 UTC, Roman Mostyka
Details
Ooops, it was non-transactional DB. (43.17 KB, image/jpeg)
2008-10-16 17:08 UTC, Roman Mostyka
Details
Created on mYISAM engine sakila DB without keys. (121.81 KB, image/jpeg)
2008-10-16 17:10 UTC, Roman Mostyka
Details
Patch applied for db.mysql module in release65_fixes repository. (3.48 KB, patch)
2008-11-18 13:37 UTC, rbalada
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-10-16 17:00:38 UTC
1. Start MySQL with MyISAM engine.
2. Register this MySQL in IDE.
3. Rightclick it and choose "Create Database".
4. Choose some sample DB and click "OK".

Result: DB is created, but script can't be executed since MyISAM engine. Look attached message.log for detailed exception.
Mark it as WONTFIX if it can be fixed, since foreign keys require InnoDB.
Comment 1 Roman Mostyka 2008-10-16 17:04:36 UTC
Created attachment 72015 [details]
Log file of NetBeans.
Comment 2 Roman Mostyka 2008-10-16 17:06:12 UTC
By the way, I tried to create sakila on the same server and it was successfully without problem. But unfortunately again
without foreign keys.
Comment 3 Roman Mostyka 2008-10-16 17:08:14 UTC
Created attachment 72017 [details]
Ooops, it was non-transactional DB.
Comment 4 Roman Mostyka 2008-10-16 17:10:45 UTC
Created attachment 72018 [details]
Created on mYISAM engine sakila DB without keys.
Comment 5 David Vancouvering 2008-10-16 17:56:14 UTC
It looks like this is the trick that Sakila uses:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

and then at the end of the script:

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

I'll try that with our samples and see if that solves the problem.
Comment 6 David Vancouvering 2008-10-27 23:58:42 UTC
Just so it's clear, MyISAM does NOT support foreign keys.  So creating a database on MyISAM successfully but without
foreign keys is the best you're going to get.
Comment 7 David Vancouvering 2008-10-28 00:05:30 UTC
Roman, can you please try the following.  I can't figure out what is making things work for Sakila and not for 'sample'
- the syntax is almost exactly the same.

I did one little tweak to make them the exact same syntax.  Can you please try to execute this statement below and see
if it works for you?

CREATE TABLE customer (
   customer_id INTEGER PRIMARY KEY NOT NULL,
   discount_code CHARACTER(1) NOT NULL,
   zip VARCHAR(10) NOT NULL,
   name VARCHAR(30),
   addressline1 VARCHAR(30),
   addressline2 VARCHAR(30),
   city VARCHAR(25),
   state CHARACTER(2),
   phone CHARACTER(12),
   fax CHARACTER(12),
   email VARCHAR(40),
   credit_limit INTEGER ) ENGINE=InnoDB;

Thanks!
Comment 8 David Vancouvering 2008-10-28 00:07:55 UTC
You know, the more I think about it, I really don't think we should support creating our samples on MyISAM.  The reason
is that without foreign keys, these samples are *broken* - e.g. they break our tutorials.

So the fix for this will be to determine if the server supports InnoDB, and if it doesn't, then raise a dialog saying
that InnoDB needs to be enabled.
Comment 9 Roman Mostyka 2008-10-28 10:29:29 UTC
If it breaks our tutorial, then I agree that it's better just inform customer that MySQL should run InnoDB engine for
creation of sample DBs.
But probably we can just inform customer that MyISAM is enabled and DB will be created without foreign keys and
therefore DB won't be absolutely valid. If foreign keys are necessary, then InnoDB should be enabled.
Comment 10 David Vancouvering 2008-10-28 16:48:28 UTC
I have not figured out a way to have the same script work with MyISAM and InnoDB.  I also don't feel like maintaining
two versions.  I do not believe it's an onerous requirement to require InnoDB - from
http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html: "InnoDB is included by default in all MySQL 5.0 binary
distributions"

I am going to check in a fix where we raise an error dialog with useful information if InnoDB is not enabled.  I haven't
been able to test it because I can't seem to make InnoDB go away on my installation.   So after I check it in, can you
please test it, Roman?  
Comment 11 David Vancouvering 2008-10-28 20:20:06 UTC
a1b3533332b5
Comment 12 David Vancouvering 2008-10-28 23:32:30 UTC
Fixed
Comment 13 Roman Mostyka 2008-10-30 18:21:53 UTC
Verified with build 081030.
Comment 14 Quality Engineering 2008-10-31 04:47:52 UTC
Integrated into 'main-golden', will be available in build *200810310201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a1b3533332b5
User: David Van Couvering <davidvc@netbeans.org>
Log: #150422: Sample DB can't be created without InnoDB
Comment 15 rbalada 2008-11-14 12:48:48 UTC
Roman, David,

the changeset for this issue touches module org.netbeans.modules.db.mysql.sakila, which is not available to 6.5 users.
Neither in 6.5 IDE installation nor any of 6.5 UCs. Please advise how to proceed with this fix.

Related questions are:
#1 Is the org.netbeans.modules.db.mysql.sakila module going to be published on any of NB 6.5 UCs?
#2 What repository will be selected as a source base for building org.netbeans.modules.db.mysql.sakila module's binary?
Possible options could be i.e. release65 or release65_fixes.
#3 Is it enough to commit only partial change affecting just module org.netbeans.modules.db.mysql? If yes and not
explained earlier, what is the plan for the rest of the fix affecting just org.netbeans.modules.db.mysql.sakila module?

Thanks,
-R
Comment 16 David Vancouvering 2008-11-14 17:18:21 UTC
Sakila is *suposed* to be on the stable UC.  The change to Sakila is independent and does not rely on core modules, nor
do core modules rely on the change.

It is disconcerting that it is not there.  Can you please follow up, Roman?
Comment 17 rbalada 2008-11-18 11:29:47 UTC
David,

I'll proceed with just partial fix touching only org.netbeans.modules.db.mysql module as you suggested. Publishing of
Sakila module is another story and as I understood it should be published only via Update Center. 
I'll attach the partial changeset. I checked the whole changeset and confirmed the fix has been duplicated into both
modules, so it should be really safe to apply just partial changeset.

-R
Comment 18 rbalada 2008-11-18 13:37:23 UTC
Created attachment 73866 [details]
Patch applied for db.mysql module in release65_fixes repository.
Comment 19 rbalada 2008-11-18 13:47:17 UTC
I've applied the attached patch made of changeset http://hg.netbeans.org/main/rev/a1b3533332b5 into release65_fixes
repository as http://hg.netbeans.org/release65_fixes/rev/21762754d288
Comment 20 David Vancouvering 2008-11-18 16:40:40 UTC
Patch looks good, thanks for figuring this out.  I'll remember to keep Sakila fixes in separate patches moving forward.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo