This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
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.
Created attachment 72015 [details] Log file of NetBeans.
By the way, I tried to create sakila on the same server and it was successfully without problem. But unfortunately again without foreign keys.
Created attachment 72017 [details] Ooops, it was non-transactional DB.
Created attachment 72018 [details] Created on mYISAM engine sakila DB without keys.
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.
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.
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!
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.
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.
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?
a1b3533332b5
Fixed
Verified with build 081030.
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
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
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?
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
Created attachment 73866 [details] Patch applied for db.mysql module in release65_fixes repository.
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
Patch looks good, thanks for figuring this out. I'll remember to keep Sakila fixes in separate patches moving forward.