views:

362

answers:

6

I need to generate multiple databases to SQL, so I need script/program to automatically generate those to SQL and generate files to jboss server. Our client server is running in Linux, but I develop on Windows machine. Should I make script with as Linux script or write Java program that could make same things?

A: 

Is it the tables that you are generating?

Paxinum
If you want to ask questions about the question, please use "add comment" on the question. This is not an answer!
Vinay Sajip
Sorry, I meant I need to generate databases. Only differenece in these databases is name. And names are like database_1, database_2 etc... and I need to add some files to application path that are config files to those databases. These databases are generated when our client gets new customers...
newbie
+3  A: 

A shell script will usually be a lot easier and quicker to develop.

Write a Java app if you need a robust, user ready application. That's not the case here so just make your life easy.

Kristof Provost
+1  A: 

Unless it is very simple it is far less painful to do it in Java. So I think you should write a Java program.

But have you considered writing it in Perl or Python? These are very powerful scripting languages and the resulting program can be much shorter and/or more concise than a corresponding Java program.

Peter Mortensen
+1 for Perl — probably worth taking a look at it with SQL::Translator
David Dorward
A: 

I often use shell-scripts for one-shot tasks like generating big sets of testdata.

Mnementh
A: 

The Linux shell script languages are easy and quick to develop for simple things. They are very easy to maintain because they're pure text, interpreted by the shell.

They are painful to use for anything more complex than a few dozen lines of code. They aren't proper programming languages. If you have any text substitution or calculation of sizes, it becomes difficult to write.

If you're doing only directory creation and file copies, use a shell script.

Java programs are hard to develop because they require compiling (and perhaps a complete IDE). They are hard to maintain because they are compiled. You can use properties to enhance maintainability, but that's quite a bit more programming.

Java programs are great for things that are complex. If you have a lot of text substitution, or calculation, Java works out better. Java is a proper language with lots of features for doing lots of things.

You have a middle ground: the flexibility of scripting, the sophistication of a full programming languages. Tools like Groovy or Python are "dynamic" languages -- they are very easy to write and maintain -- but they're also full programming languages, not just the shell.

If your script involves any text manipulation or calculation, you might want to consider Groovy or Python instead of the shell or Java.

S.Lott
A: 

Beware what you build, as it will last a lot longer than you think.

If the effort to code it either way is roughly equal, then code it in the language which is most widely used by your organization.

One thing I see over and over at companines is the "wow, I can code this using shiny new (or shiny old) technology BZUP12G with Frammoplatzes". This does a disservice to the rest of the development team, who now have to learn BZUP12G with Frammoplatzes in order to modify what got built. Working to keep the basic set of technologies on which your application is constructed to a reasonably small set is a really good idea.

Ira Baxter