This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes doubt regarding jdbc syntax error while creating a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "doubt regarding jdbc syntax error while creating a table" Watch "doubt regarding jdbc syntax error while creating a table" New topic
Author

doubt regarding jdbc syntax error while creating a table

suresh mandalapu
Ranch Hand

Joined: Sep 14, 2008
Posts: 32
hi.. i am using mysql 5.1.3 version.. when i try to create a table it is giving the following error..please help..
create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))
the error is
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 'generated by default as identity (start with 1), EVENT_DATE timestamp, title var' at line 1
.......................
schema export complete..
............................

thanks
suresh
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3700
    
    5

The error is pretty helpful here, your syntax is wrong. Find an example of good syntax for events in mysql and use that.


My Blog: Down Home Country Coding with Scott Selikoff
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
There is no such data type as "generated by default etc". There is a shorthand type in MySQL which you should find in the manual.
 
wood burning stoves
 
subject: doubt regarding jdbc syntax error while creating a table
 
Similar Threads
hibernate usage--sql syntax error
Could not find a getter for id1 in class ........
Database problem in JBoss
Repeated updates on EVENT table, in Hibernate one to many mapping
Running MySql query as a sql script