• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Usage of Reserved words for Database Table fields

 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one more problem...
Im doing a Database Migration from HSQL to DERBy..

Some of the tables in my Source Database(HSQL) have reserved words like "USER", "CLOSE", "OPEN"...etc

When I migrate the database to DERBY which is my destination DB Im getting trouble with these reserved words... the table which have these reserved words raises exception..and the table is never created..

Any solution to check for the fields which are reserved words ?

Please let me know...

Thanks,
Sudheer.

[ August 01, 2006: Message edited by: Sudheer Yeddu ]
[ August 01, 2006: Message edited by: Sudheer Yeddu ]
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Database migration is nontrivial, especially with create table statements and stored procedures. You could check online documentation for a list of reserved words. As far as converting the data, if you have a large enough set of data you might consider writing a tool that reads the exported SQL data, and does the conversion for you, else you have to do it by hand.
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sudheer Yeddu:

Some of the tables in my Source Database(HSQL) have reserved words like "USER", "CLOSE", "OPEN"...etc



Some databases allow you to use reserved words (or even mixed-case table names) by quoting the table name. For example:



I don't know enough about the DBs you're using to know if that's helpful.

Usually, if you have to create them with quotes, then you also have to reference them with quotes in your SELECT and INSERT statements.
 
Tauri Valor
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies...

I also want to know whether we have any way to track the reserved words, so that I can wrap them in quotes to work after locating them..

Thanks,
Sud
 
Tauri Valor
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please go thru my blog if needed, btw I have published in my blog as it may be of any help to folks doing the same...

http://taurivalor.wordpress.com/

Thanks,
Sudheer.
 
Tauri Valor
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally I could do it this way..

I Put the reserved words in an array and did a check if the field name matches any one of the elements in that array.

Cheers,
Sud.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic