Database connection lost after editing screen

I have added a database connection in Advanced Customisation / Tables and Databases.  I'm able to retrieve data successfully using the usual CRM objects.  However, if I edit a CRM screen layout and save it, the database connection disappears until I run a metadata refresh for Tables and Columns.  The self service database also disappears and reappears after the metadata refresh.  This is on CRM 2021 R1.

Is this a known issue?

  • 0

    This has always been the case but I am not sure if Sage "know" about it. I guess now is the time to make them aware :-)

  • 0

    This has always been the case but I am not sure if Sage "know" about it. I guess now is the time to make them aware :-)

  • 0 in reply to Kieron_Moran

    Well it certainly didn't used to be the case, but I haven't had the need to make connections to external databases for a while.  I think the last time was in 2018, so only about 3-4 years.  I'm sure it was OK then.

  • 0

    This is a known issue.  It appears as resolved in Sage CRM 2022 R1 release notes.

    CRMS-673/CRM-676 - Database -User interface.  When a system administrator added a new database connection in | Administration | Advanced
    Customization | Tables and Databases, the connection did not appear on the screen.

  • 0 in reply to Sage CRM

    Could be the same thing but I'm able to create the database connection and it does appear on screen.  It's only after I edit a screen layout (eg add a field or whatever) and save it that the database connection disappears.

  • 0 in reply to Paul C

    Is this reproducible on 2022 R1?

  • 0

    It may be a known issue, but a long time a go I had an issue with a database connection disappearing and being a problem and it was because the database was on a SQL Express instance. By default databases on SQL Express are (or were) set up by default to auto close. Change this in the database properties so that it doesn't auto close. It may resolve the issue. I also had an issue once where the original database was a SQL Express instance and was upgraded over time to full SQL but this property stayed as the default for SQL Express.

  • 0 in reply to Vega

    I think that issue of the database closing is likely to be where you would get the "You may need to recreate views" type message - the closing of the database would be more severe that the invisibility of the metadata.

  • 0 in reply to Sage CRM

    Just had a similar issue on CRM 2022 R1.  I added multiple database connections.  As I added each one it appeared on screen but all the previous ones disappeared.  When I ran a metadata refresh for Tables and Columns they all became visible again.  Editing any one of them made all the others disappear until running another metadata refresh.

    This time the self-service database remained visible.  It was just the database connections I added that disappeared.

  • 0 in reply to Paul C

    This has become more of an issue than an irritation.  It seems that the database connections may be disappearing when nobody has changed anything in metadata (ie no changes made in Administration/Customisation).  Users get '500' errors when accessing pages that use the connected databases.  After running refresh metadata for tables and columns it all works again.

  • 0 in reply to Paul C

    I think this needs to be logged as a case.  Sage CRM opens all database connections on start up so if one is dropping (for example a 3rd party database connection) then this pretty strange.  It may be the database itself ending the connection so it would need to be investigated.

  • 0 in reply to Sage CRM

    How would making a customisation in CRM cause the linked databases to end their connections?  All at the same time?

    Would refreshing the metadata force CRM to reconnect to the databases?  

    I don't think the databases are getting disconnected.  I think this issue is caused by the metadata refresh that runs when, eg, a screen customisation is saved.  The metadata for the database connections is removed from memory and only comes back when a manual metadata refresh is run.  The http 500 errors are caused by the asp page script trying to use the database argument of the CRM.CreateQueryObj(sql, database) method.  On my dev system (with serverside debugging enabled) I can reproduce the error: