Menu

Database name defined at run-time?

Brandon
2005-03-16
2013-03-07
  • Brandon

    Brandon - 2005-03-16

    Maybe I'm missing something simple, but I can't seem to figure out a way to use multiple databases. I need to be able to allow the user to create multiple databases, all with the same schema, and pick which database they need to work with when the application starts up.

    After casually browsing the source code, It seems that the table mappings are intimately linked with the database described in the XML mapping file. Because of this, it seems like I'll have to generate a new mapping file for each database the user creates. Is there a way to omit a database connection in the XML and instead dynamically add a database to the PersistenceBroker at runtime and have it use the table/column mappings in the XML file?

    I'll generate separate mapping files for each database if I must, but I'm really hoping a cleaner solution is out there. Thanks for any assistance!

     
    • Richard Banks

      Richard Banks - 2005-03-16

      There is actually a reafture request for this sort of thing outstanding - events for missing parameters.

      At the moment, my only suggestion is to modify the XML file at runtime with the needed parameters before calling the init() method of the persistence broker.  It's not clean but it should work until I get the other change done.

       
    • Brandon

      Brandon - 2005-03-17

      Sounds good! Guess I should've thought to look in the feature request section as well. :)

      Thanks for the reply. Glad to know those are being worked on!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.