On Apr 13, 2006, at 9:33 AM, Greg Monroe wrote:
I don't believe you can get this sort of logic to work. Here's
why:
The "database" name in Torque actually refers to Torque's object
space "database" and not any physical SQL Server database. The
Torque db name is defined in your schema xml (name attribute on
Database tag). This name is used as a key to tie a lot of
information together.
Thanks for the reply, Greg! Much appreciated!
I may have not been very clear on the setup I have. Basically, I
generate all Torque objects for the mysql database only and use the
second one with straight SQL and BasePeer.executeQuery(sql, dbName)
or BasePeer.executeStatement(sql, connection). I am not trying to use
Table1Peer for both databases.
But when I do
String initSql = "select cdcaux.ctenvinit('user.tablespace') from dual";
BasePeer.executeQuery(initSql, "oracle");
the query is done in my mysql database, not the oracle one.
[snip]
That said, here's what I do to deal with this situation. I treat
configuration information as being totally separate from application
code. It's for configuration after all and so any code updates
should not change it. So, while I may have a sample config file
checked into the repository, I never have a real configuration
property checked in.
In my code, I initialize Torque by searching the class path for
the configuration file. E.g.:
URL url = this.getClass().getClassLoader().getResource(
getDbParameterFileName());
// Note: Don't use new URI(url.toString())
// - Tomcat will not resolve this!.
String path = url.getPath();
if ( path != null && ! path.startsWith("/")) {
path = "/"+path;
}
URI uri = new URI(url.getProtocol(),"",path,null);
return new File(uri);
This lets me have different configuration files for various
situations, like for junit testing under Eclipse, a development
server using MySQL, and multiple production servers using
different DB's but all using the same code.
This is very useful for having multiple configurations. Thanks!!
cheers,
h.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]