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.

Bug 152107

Summary: [65cat] Unable to create or delete tables in MySQL support with names that need quoting
Product: db Reporter: sunbiz <sunbiz>
Component: CodeAssignee: David Vancouvering <davidvc>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=135040
Issue Type: DEFECT Exception Reporter: 135040
Attachments: stacktrace

Description sunbiz 2008-11-01 20:55:56 UTC
Build: NetBeans IDE 6.5 RC2 (Build 20081031212129)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc2-b32
OS: Windows Vista, 6.0, x86

Stacktrace: 
java.lang.Exception: The database command createDatabase failed with the following exception:
        at org.netbeans.modules.db.mysql.impl.MySQLDatabaseServer$DatabaseCommand.run(MySQLDatabaseServer.java:970)
        at org.netbeans.modules.db.mysql.impl.ConnectionProcessor.run(ConnectionProcessor.java:111)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Comment 1 sunbiz 2008-11-01 20:56:01 UTC
Created attachment 73056 [details]
stacktrace
Comment 2 David Vancouvering 2008-11-03 19:23:50 UTC
I can reproduce this by trying to create a database with the "*" character in it.  Such a database name needs to be
quoted.  MySQL using the backtick character (`) for quoting, see http://dev.mysql.com/doc/refman/5.0/en/identifiers.html.

When I backtick the *, the database is created correctly.  However, the database connection for this database that we
create automatically causes an error, as we directly translate the backticks to the JDBC URL, and MySQL can't find the
database `*`.

This basically means this functionality is broken for database names that have characters that must be quoted
(particularly multibyte characters). I tested with 前空幕長が会見 (a string of characters I got from
http://www.yahoo.jp) and I got the same problem.

Since this breaks international support, it's a P2, and I'm copying Ken Frank, our I18N guy.  

It would be nice if we detect that the string needs to be quoted and quote it, but at a minimum we should correctly
support quoting.
Comment 3 David Vancouvering 2008-11-03 19:25:51 UTC
Note: we also need to fix *deleting* databases that have characters that need quoting.  Right now this fails with a
syntax exception.
Comment 4 David Vancouvering 2008-11-03 20:25:29 UTC
8103d60a32dd

Used the very nice Quoter API.  Made it very easy to fix this.  Thanks to whoever wrote this API (oh, wait, it was me! :)).

Now you can use multibyte or other characters in your db name that need quoting, and you can both create and delete the
databases.  
Comment 5 Quality Engineering 2008-11-04 16:24:02 UTC
Integrated into 'main-golden', will be available in build *200811041401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8103d60a32dd
User: David Van Couvering <davidvc@netbeans.org>
Log: #152107: [65cat] Unable to create or delete tables in MySQL support with names that need quoting
Comment 6 David Vancouvering 2008-11-05 20:46:38 UTC
*** Issue 152448 has been marked as a duplicate of this issue. ***
Comment 7 David Vancouvering 2008-11-05 20:48:27 UTC
Issue 152448 is fixed as a duplicate, removing it as a depending item. I just tested 'test*1' in my sandbox and it
works, please verify.
Comment 8 Roman Mostyka 2008-11-07 08:45:16 UTC
Verified with build 081107.
Comment 9 rbalada 2008-11-18 14:22:08 UTC
I've ported the changeset http://hg.netbeans.org/main/rev/8103d60a32dd into release65_fixes repository as
http://hg.netbeans.org/release65_fixes/rev/13744aebb76d