I am starting a new project in which I will use database a lot . Now to begin with , I have to make some .sql files . I want to know what will be in these .sql files ? only sql queries for table creating/accessing or anything else . And MOST IMPORTANT IS : FROM A JAVA PROGRAM HOW I WILL USE THE .SQL FILES .
any sample coding will be highly appreciated . At the bigging of the project I only have the database table's blueprint .
[edited subject to remove shouting, was: HOW TO USE .SQL FILES USING JAVA] [ June 24, 2006: Message edited by: Jeanne Boyarsky ]
Prasanna, The first thing is to think about what you want in the SQL files. I think it is a good idea to have different files for different things.
For example, you could have a SQL file for the ddl/initial setup. Then you could have a property file for common queries. It is easier to use a property file if you only want to run one query at a time.
MOST IMPORTANT IS : FROM A JAVA PROGRAM HOW I WILL USE THE .SQL FILES .
Note that all caps is usually viewed as shouting on the Internet - probably not what you were going for.
The Java program would read in the SQL files, parse them to separate statements (probably on the semicolon delimitter) and then pass them along to the database using JDBC.