Results 1 to 3 of 3

Thread: System.Exception {Spring.Data.UncategorizedAdoException}

  1. #1
    Join Date
    Feb 2007
    Location
    frankfurt, germany
    Posts
    52

    Default System.Exception {Spring.Data.UncategorizedAdoException}

    Hello,

    I'm using the Spring.Data 20070607 and almost all worked fine.
    My application contains UserService that gets a UserDAO injected(where I call stored procedure in order to fill a UserDTO)
    Today I tried to add some new functionality into the UserDAO: I added AuthorizationRights (StringCollection) to the UserDTO-Class and within the UserDAO I tried to fill this new property with

    PHP Code:
    try
                {

                    
    userDTO  = (userDTO)AdoTemplate.QueryForObject(CommandType.TextsqlGetUserByID, new UserRowMapper(),"ID"DbType.String30ID);
                    
    userDTO.AuthorizationRights getAuthorizationRights(ID);
                    

                } 
    so I try to call another sp within UserDAO with ADOTemplate.QueryWithResultSetExtractor
    PHP Code:
    public virtual StringCollection getAuthorizationRights(string ID)
            {
                
    IDbParameters parameters AdoTemplate.CreateDbParameters();
                
    parameters.Add("ID"SqlDbType.VarChar0x30).Value ID;

                return (
    StringCollectionAdoTemplate.QueryWithResultSetExtractor(CommandType.StoredProcedure,  "sp_getAuthorizationRightsByID",
                                                               new 
    AuthorizationRightsResultSetExtractor(), parameters);         } 
    If I execute this code, I get

    {"CommandCallback; uncategorized DataException for SQL [sp_getAuthorizationRightsByID]; ErrorCode [<no error code>]; the stored procedure sp_getAuthorizationRightsByID' not found."} System.Exception {Spring.Data.UncategorizedAdoException}

    Any Ideas?
    (the sp exists on the db server and a user got sufficient Execute rights)


    StackTrace
    PHP Code:
    "   bei Spring.Data.Support.FallbackExceptionTranslator.Translate(String task, String sql, Exception exception)\r\n   bei Spring.Data.Support.ErrorCodeExceptionTranslator.Translate(String task, String sql, Exception exception)\r\n   bei Spring.Data.AdoTemplate.Execute(ICommandCallback action)\r\n   bei Spring.Data.AdoTemplate.QueryWithResultSetExtractor(CommandType cmdType, String cmdText, IResultSetExtractor resultSetExtractor, IDbParameters parameters)\r\n   bei Serad.VBP2.DataAccessLayer.Spring.DAO.ADOTemplateImp.UserDAO.getLocationbasedRights(String ID) in D:\\Development\\VBP_Online\\VBP2\\Modules\\DataAccessLayer\\Spring\\DAO\\ADOTemplateImp\\UserDAO.cs:Zeile 125.\r\n   bei Serad.VBP2.DataAccessLayer.Spring.DAO.ADOTemplateImp.UserDAO.getUserByOKennung(String ID) in D:\\Development\\VBP_Online\\VBP2\\Modules\\DataAccessLayer\\Spring\\DAO\\ADOTemplateImp\UserDAO.cs:Zeile 45."    string 
    Last edited by boriska; 09-25-2007 at 04:23 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    frankfurt, germany
    Posts
    52

    Default

    Oh, sorry...
    That's my mistake: I forgot that i initialize UserDAO with credentials for an another database...
    BTW ... Could I use multiple databases within UserDAO : AdoDaoSupport ?
    How can I configure ADOTemplate?

    Thanks

  3. #3
    Mark Pollack is offline Spring.NET Co-Lead Spring TeamSpring User
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    1,683

    Default

    Hi,

    If you want to use multiple databases, by which I guess you mean use distributed transactions, then you will need to use either

    ServiceDomainPlatformTransactionManager - distributed transaction manager from EnterpriseServices
    TxScopePlatformTransactionManager - local/distributed transaction manager from System.Transactions.

    See the section in the reference docs, Key Abstractions, for more information on their usage.

    Your code that uses AdoTemplate will not need to change. The configuration of AdoTemplate will change.

    One instance of AdoTemplate will refer to a DbProvider for database A and and another instance of AdoTemplate will refer to a DbProvider for database B. Then your data access objects will refer to the appropriate version AdoTemplate.

    If your data access objects are based on AdoDaoSupport, then you can simply provide it the DbProvider for database A or B as appropriate, the AdoTemplate is created for you.


    Hope this helps.

    Cheers,
    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •