Hi all,

 I was wondering about the Ibatis approach to storing connectionstrings. Ibatis 
now stores the connection strings in the sqlmap file, with optional property 
replacement like so:

  <database >
    <provider name="sqlServer20005" />
    <dataSource name="TheDB" connectionString="data 
source=${datasource};database=${database};user 
id=${username};password=${password};NETWORK=dbmssocn"/>
  </database>

Now since we sometimes have to share a connection string with other code which 
prefers storing the connectionstring in the <connectionStrings> section of the 
.config file, we have to maintain a copy of the connectionstring in both 
places. What would be ideal would be the option on saying something like:

  <database >
    <provider name="sqlServer20005" />
    <dataSource name="TheDB" connectionStringName="TheDbConnectionString"/>
  </database>

And then in our .config file say

<connectionStrings>
                <add name=" TheDbConnectionString " 
connectionString="Database=TheDB;Server=TheDBServer;User Id=Spam;Pwd=Eggs;" 
providerName="System.Data.SqlClient"/>
</connectionStrings>


This would also allow us to use the configuration encryption features in the 
.net framework: http://msdn2.microsoft.com/en-us/library/ms998280.aspx

Comments, improvments, ideas ?

Implementing this seems like something that might be done really quickly. I'll 
implement it tonight and submit a patch if people would like to see it merged 
into the SVN release.

 - Oddur

Reply via email to