"Weaver, Scott" wrote:
> 
> Got a question ;)
> 
> Why does the doBuild() method in all of the Torque-generated peers have the
> database map hard coded?
> 
> dbMap = TurbineDB.getDatabaseMap("jstore");
> 
> The reason I bring this up is because I had changed a couple of things
> around when I was building my app where this caused me problems.  I had a
> project name of "store", but I wanted the database to be called "jstore."
> So, after running the first ant to create the project in the webapp
> directory, I went into build.properties and changed both the
> Turbine-schema.xml and store-schema.xml from <database name="store"> to
> <database name="jstore">.  I also changed the idTableDatabase from
> "idTableDatabase = store" to "idTableDatabase = jstore" then ran "ant init"
> which created these entries in my turbine.properties
> 
> database.store.driver=org.gjt.mm.mysql.Driver
> database.store.url=jdbc:mysql://127.0.0.1/jstore
> database.store.username=-----
> database.store.password=-----
> 
> services.PoolBrokerService.defaultPool = store
> services.MapBrokerService.defaultMap = store

The way it should work is if you use <database name="jstore"> the
properties should be named jstore as well, e.g. database.jstore.driver. 
The actual name of the database that would go in the url, does not need
to be related to any hardcoded strings in the om/peer/map classes.  I
thought the tdk made a simplifying assumption that the actual db name
and the name referenced in turbine code would be the same.  But it seems
from your example the tdk assumes a the name used in TR.props is the
project name, while the om/peer/map objects use the name specified in
the xml schema.  This needs to be fixed, as it obviously will not work
for multiple databases.  btw, (mostly to jason) does a project name have
any purpose, if torque assumes it should operate on all xml files in the
schema directory?

john mcnally


> 
> But all the map classes had the line:
> 
> dbMap = TurbineDB.getDatabaseMap("jstore");
> 
> in the doBuild() method which was causing all off my peers to fail with a
> "connection is null!" exception.
> 
> After changing all references to "store" to "jstore" in the above lines in
> turbine.properties everything worked fine.
> 
> My point is, why not grab the value for the default map from
> turbine.properties like this:
> 
> dbMap =
> TurbineDB.getDatabaseMap(TurbineResources.getString("services.MapBrokerServi
> ce.defaultMap"));
> 
> Would this not make things a little more flexible and less prone to error
> (IMOHO hard-coding is not the best approach)? Am I think correctly here or
> is my logic totally off base.
> 
> Regards,
> Scott
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to