Sigal Shaharabani
Sigal Shaharabani

Reputation: 450

Can I make a Derby sql script with parameters?

I'd like to add Derby to my glassfish application, to store one piece of information.

However, I don't want to make the inserts/updates via the application if I can.

I can run ij with a script to create the database and table, but to make the insert and update the information needs to be given by the user and I cannot find a way to do this with ij or any other tool. I know how to do it with other databases, but I am getting lost in the Derby documentation. Is there a way to run an SQL script with parameters?

Many thanks

Upvotes: 0

Views: 444

Answers (1)

Bryan Pendleton
Bryan Pendleton

Reputation: 16349

Two ideas come to mind:

  1. Write a program which takes the information from the user, and generates the ij script containing that information as appropriate, then run the ij script that you have generated,
  2. Take the information from the user and write it out into a form such as a CSV file, then use the import procedure (http://db.apache.org/derby/docs/10.8/ref/rrefimportproc.html) to read the data from the CSV file and load it into the database.

But to be honest, I always just make the inserts and updates from my application. It's simple, and easy to code, and I can get the data exactly the way I want it, and it's plenty fast enough.

Upvotes: 1

Related Questions