Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running .sql File in java

 
Amit Lonkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I have to run a a ".sql" file through java. Can anyone tell how it can be done.
Regards
Amit Lonkar
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
-arun
 
Amit Lonkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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.
Reagrds
Amit Lonkar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic