db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remke Rutgers <Remke.Rutg...@brightalley.nl>
Subject RE: runtime SQL script execution using torque
Date Wed, 30 Jul 2003 10:05:42 GMT


> -----Oorspronkelijk bericht-----
> Van: Simon Vallet [mailto:svallet@t-systems.fr]
> Verzonden: dinsdag 29 juli 2003 16:24
> Aan: Apache Torque Users List; mbe@lucka.nl
> Onderwerp: RE: runtime SQL script execution using torque
> 
> 
> 
> > If you're using JSPs, the JSTL <sql:query> seems to be the 
> easiest way.
I am using JSP's, but I am not using JSTL at the moment. (Though this does
not mean I could not start using it.)
However, I would rather use my JSP's for presentation only.


> 
> I don't know about this, but it seems indeed simpler.
> 
> However, if you want to use Torque for insertion, something like the
> following will work (I'm not sure you still need to define the
> "torque.database.*" properties, but I did)
The reason why I thought of TorqueSQLExec is very simple:
- I can use the same approach for initial generation, for scheduled
refreshing of temporary tables (that is what the SQL script is for) and for
refreshing temporary tables from within my webapp.
- The sql parsing is done for me (yes, I know it is not very complicated)

Thanks for your feedback it got me thinking of other alternatives.
I think I could work something out with
org.apache.tools.ant.taskdefs.SQLExec and providing a new implementation for
getConnection.

Probably easier than trying to set all torque.properties.

Remke


> 
> TorqueSQLExec execSQLTask = new TorqueSQLExec();
> execSQLTask.setProject(new Project());
> 
> execSQLTask.setAutocommit(false); // or true :)
> execSQLTask.setDriver(conf.getString(MK[1])); // driver
> execSQLTask.setUrl(conf.getString(MK[2])); // url
> execSQLTask.setUserid(conf.getString(MK[3]));
> execSQLTask.setPassword(conf.getString(MK[4]));
> 
> execSQLTask.setSrcDir(sqlDir.getAbsolutePath()); // directory with SQL
> scripts
> // you will need to generate the sqldb.map before executing
> execSQLTask.setSqlDbMap(sqlDbMap.getAbsolutePath());
> 
> try { execSQLTask.execute(); }
> catch (org.apache.tools.ant.BuildException be) { ... }

Thanks, I think I will be able to get it working this way.

But, your question 'why Torque' got me thinking. I am indeed already using
database specific code, so I could just as wel use plain JDBC, I guess.

Remke
> 
> HTH,
> Simon
> --
> Simon Vallet
> T-Systems e-technologies
> svallet@t-systems.fr
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message