Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • f10x 21 posts 18 karma points
    Feb 09, 2010 @ 00:35
    f10x
    0

    Connecting to Multiple databases

    Hi All,

    We are struggling with a few database issues and hope that the Umbraco community could shed some light on a few of these issues.

    One of the portals we are working on needs to connect to a couple of databases. This is becasue:

    One database has user login details

    The other has application and user specific data.

    We have tried adding multiple connection strings in the Umbraco template, however, this does not work.

    Umbraco seems to connect to the very first connection string.

    Any suggestions or links to resources would be great.

     

    Thank  you for y our time and help.

     

     

     

     

     

     

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 09, 2010 @ 05:51
    Richard Soeteman
    0

    Hi,

    Before you start make sure there is absolutly no other way to use 1 database.

    What you could do is writing a Custom Memership provider for this. In the custom membership provider you use the database that holds the member/umbraco user information. The default database holds the data.

    Umbraco uses the normal user and member objects under the hood so you have to build a provider from scratch.

    Few references online to check.

    Tim's blog http://www.nibble.be/?p=66
    MSDN: http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx

    Hope this helps you,

    Richard

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 09, 2010 @ 08:57
    Dirk De Grave
    0

    As Richard points out, using a custom membership provider for user logins is a good start. Besides that, you can use multiple db's, and you can easily use the umbraco framework to connect to other databases

    using (var sqlHelper = DataLayerHelper.CreateSqlHelper(_connectionstring)) {...}

    will allow you to use the 'umbraco data layer' to connect to any database.

     

    Hope this helps.

    Regards,

    /Dirk

  • maheshp 1 post 21 karma points
    Jun 02, 2014 @ 12:38
    maheshp
    0

    Hiii Dirk

               Im new to umbraco can u plz provide an example to connect multiple dbs.

     

     

     

    thanks

    Mahesh

     

Please Sign in or register to post replies

Write your reply to:

Draft