Reshi
Reshi

Reputation: 799

Error in SQL syntax in NetBeans using MySQL

I'm running throught NetBeans E-commerce tutorial and I got stuck on following problem.

Here is the tutorial part. I'm concretely on step Adding Sample Data to the Database . When I execute this trivial command : select * from category; I obtain error

Error code 1064, SQL state 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1
Line 1, column 1

No values of this select are displayed, despite the fact that the table is not empty set.

I'm executing this command in NetBeans IDE 7.3 RC2 inside the Database Explorer Module using Execute Command option.

I was thinking if the problem could not be in the encoding that I use in my database. I used utf8 - utf8_unicode_ci then i changed it into utf8 default collation, but there is no change.

I use MySQL 5.6.10 and managing it via MySQL Workbench.

Thank you very much for your answers :)

EDIT and PARTIAL SOLUTION: To finish my answer and answer it partially. I don't know why the SQL script editor in netbeans does not work. But finally I successfully created the connection pool and datasource. All queries made via datasource in JSP pages work fine.

Upvotes: 3

Views: 7806

Answers (3)

Meet Parekh
Meet Parekh

Reputation: 12

netbeans evaluates the field in different way in mysql cmd if you would type this syntax say insert into user ('username', 'password') values ('xyz', 'abc'); it would work perfectly fine but in netbeans the tables and field names are indicated not in single quotes but in `` this type of quotes so this would perfectly fine in netbeans insert into user (username, password) values ('xyz', 'abc'); where string like xyz and abc are expressed in single quotes...

Upvotes: 0

invertedSpear
invertedSpear

Reputation: 11054

Looks like the netbeans connector was using a deprecated command that got removed in MySQL 5.6. Found this discussion, they seem to have found an answer:

http://netbeans.org/bugzilla/show_bug.cgi?id=224260

Upvotes: 3

Mikolaj
Mikolaj

Reputation: 190

This is a bug of the mysql driver. In netbeans change the jar of your mysql driver with the lastest version. For example with mysql-connector-java-5.1.24 the "View Data" command in NetBeans works fine.

Upvotes: 3

Related Questions