Store Fields in an external database I'm interfacing an external database with Drupal 7.  I have created custom entities and custom fields to represent the tables in the external database.  Is there a simple way to set the fields up so all CRUD uses the external database?

I still want to use Drupal's default field_sql_storage.module, but have it switch to the external database and back for these fields automatically.  Can I say "for this field, use this other database". 

Something simple like:

function mymodule_field_info() {
  return array(
    'customfield' =&gt; array(
      'label' =&gt; t('My Custom Field'), 
      'description' =&gt; t('This field stores text in the external database.'), 
      'settings' =&gt; array('max_length' =&gt; 255), 
      'instance_settings' =&gt; array('text_processing' =&gt; 0), 
      'default_widget' =&gt; 'text_textfield', 
      'default_formatter' =&gt; 'text_default',
      // Simple setting to change database.
      'database' =&gt; 'externaldb', // From settings.php $database connections.
    ), 
}


The hard way is to create a custom storage backend and use it for these fields like the Mongodb module. I've tested this and it works, but it seems like there should be any easier way if you want to use Drupal's default field_sql_storage.module. 

Would the strategic placement of db_set_active() allow me to avoid creating a full custom storage backend?
There is a Field Storage API you can use for external storage in fields.