Silly issue I had:
Simple thing cost me a bit of time. I assumed you could use whole names as the name in the config file and it would connect.
mPersMgr = new PersistenceManager(true, "conHZS"); --- this is incorrect
mPersMgr = new PersistenceManager(true, "HZS"); --- this is correct
The above in combination with a config file like this:
<rdbKey name="conHZS" databaseProduct="Unknown">
<connection>Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=TWO;Data Source=XP2005GP10HZS3</connection>
<probeAssemblyName>GP10_HZS_Model</probeAssemblyName>
</rdbKey>
<rdbKey name="conOther" databaseProduct="Unknown">
<connection>Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=HMS;Data Source=XP2005GP10HZS3</connection>
<probeAssemblyName>GP10_HZS_Model</probeAssemblyName>
</rdbKey>
<rdbKey name="con" databaseProduct="Unknown">
<connection>Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=TWO;Data Source=XP2005GP10HZS3</connection>
<probeAssemblyName>GP10_HZS_Model</probeAssemblyName>
</rdbKey>
Using the above results in always using the CON entry in the config file
If you then remove the CON connection string you then get a “No datasource key found for this entity type” error.
One other issue I had was that when you do put a _ in the key name you aren’t supposed to use the whole name in code. If you do use the whole name (like “con_HZS” you will spend lots of time figuring out why it will only use the CON key and not the other ones. (it’s because it can’t find any other CON ones so it defaults to the one that doesn’t have any _ which is what lead me to believe that you can use whole names without using an _ )
mPersMgr = new PersistenceManager(true, "con_HZS"); --- this is incorrect
mPersMgr = new PersistenceManager(true, "HZS"); --- this is correct
<rdbKey name="con_HZS" databaseProduct="Unknown">
<connection>Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=TWO;Data Source=XP2005GP10HZS3</connection>
<probeAssemblyName>GP10_HZS_Model</probeAssemblyName>
</rdbKey>
<rdbKey name="con_Other" databaseProduct="Unknown">
<connection>Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=HMS;Data Source=XP2005GP10HZS3</connection>
<probeAssemblyName>GP10_HZS_Model</probeAssemblyName>
</rdbKey>
<rdbKey name="con" databaseProduct="Unknown">
<connection>Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=TWO;Data Source=XP2005GP10HZS3</connection>
<probeAssemblyName>GP10_HZS_Model</probeAssemblyName>
</rdbKey>
Posting this in the hope that someone else doesn't make the mistake I made when trying to connect to different datasources.
Jaydel