Skip to content
Advertisement

Running a .sql script using MySQL with JDBC

I am starting to use MySQL with JDBC.

I have 3-4 tables to create and this doesn’t look good.

Is there a way to run a .sql script from MySQL JDBC?

Advertisement

Answer

Ok. You can use this class here (posted on pastebin because of file length) in your project. But remember to keep the apache license info.

JDBC ScriptRunner

It’s ripoff of the iBatis ScriptRunner with dependencies removed.

You can use it like this

That’s it!

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement