Is there any way to dynamically specify the URL/id/pw for a DB-VA generated project. It seems that these are hardcoded in the database.cfg.xml and [project].cfg.xml. Is there anyway to specify these dynamically from within my main application.
Thanks
Susan Frye
Jick
February 10, 2006, 9:53am
2
Dear Susan,
Sorry for my late reply. Yes, you can dynamically specify in code the URL, user name, password and other parameters related to connection. Here is the code sample:
JDBCConnectionSetting connectionSetting = new JDBCConnectionSetting();
connectionSetting.setConnectionURL("jdbc:mysql:///test");
connectionSetting.setDialect("org.hibernate.dialect.MySQLDialect");
connectionSetting.setDriverClass("com.mysql.jdbc.Driver");
connectionSetting.setUserName("root");
connectionSetting.setPassword("pwd");
UntitledPersistentManager.setJDBCConnectionSetting(connectionSetting);
Note that you should invoke the above methods BEFORE calling PersistentManager.instance().
If there are any questions, please let me know.
Best Regards,
Jick
[quote=Jick]Dear Susan,
Sorry for my late reply. Yes, you can dynamically specify in code the URL, user name, password and other parameters related to connection. Here is the code sample:
JDBCConnectionSetting connectionSetting = new JDBCConnectionSetting();
connectionSetting.setConnectionURL("jdbc:mysql:///test");
connectionSetting.setDialect("org.hibernate.dialect.MySQLDialect");
connectionSetting.setDriverClass("com.mysql.jdbc.Driver");
connectionSetting.setUserName("root");
connectionSetting.setPassword("pwd");
UntitledPersistentManager.setJDBCConnectionSetting(connectionSetting);
Note that you should invoke the above methods BEFORE calling PersistentManager.instance().
If there are any questions, please let me know.
Best Regards,
Jick
[/quote]
How to do this with C#?
Jick
February 13, 2006, 1:17pm
4
Hi,
I am sorry, dynamic DB configuration is available in Java ORM only. I will pass your request to our engineers to follow up.
Best Regards,
Jick
[quote=Jick]Hi,
I am sorry, dynamic DB configuration is available in Java ORM only. I will pass your request to our engineers to follow up.
Best Regards,
Jick
[/quote]
Normally, how long will it take for this feature to release? (Because I am urgent in using it.)
And, can the connection string be set by .getCfg.setProperty?
Jick
February 20, 2006, 10:42am
7
Dear Susan,
The ability of dynamic db configuration for C# ORM is added in the latest release. Please update your tool with the update program, and re-generate the ORM. The following article shows you how to perform update:
http://resource.visual-paradigm.com/tips_and_tricks/general/keeping_your_tool_up-to-date_by_vp_suite_update.html
Here is method calls related to DB configuration in C# ORM:
Orm.Cfg.DotNetConnectionSetting setting = new Orm.Cfg.DotNetConnectionSetting();
setting.ConnectionString = "Server=localhost;Database=test;User ID=root";
setting.Dialect = "NHibernate.Dialect.MySQLDialect";
setting.DriverClass = "NHibernate.Driver.MySqlDataDriver";
UntitledPersistentManager.SetConnectionSetting(setting);
If there are any questions, please feel free to let me know.
Best Regards,
Jick