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 Java in General and the fly likes Running .sql File in java 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 » Java » Java in General
Bookmark "Running .sql File in java" Watch "Running .sql File in java" New topic

Running .sql File in java

Amit Lonkar

Joined: Dec 12, 2001
Posts: 25
Hi all
I have to run a a ".sql" file through java. Can anyone tell how it can be done.
Amit Lonkar
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
i guess ".sql" file you are talking contains set of sql statements. Hence you can write the stored procedure in the back end and execute the same using java.

Sharing is learning
Amit Lonkar

Joined: Dec 12, 2001
Posts: 25
I am using Mysql. So stored procedures might not be possible.
One way i found out is, I need the command
mysql --execute="c:/test.sql" to be execute. I put this in a batch file, and ran the batch file using Runtime class.
Amit Lonkar
jQuery in Action, 2nd edition
subject: Running .sql File in java
Similar Threads
Convertion of xml file to sql file.
how to use .sql files using java
database integrity
running sql script file from java