How to save content created by selected roles in an external database?
Yes you can do that.

There are two method for configuring external database.


Inside settings.php
Inside Module directly.


1. Inside settings.php

$databases = array();
$databases['default']['default'] = array(
  // Drupal's default credentials here.
  // This is where the Drupal core will store its data.
);
$databases['my_other_db']['default'] = array(
  // Your secondary database's credentials here.
  // You will be able to explicitly connect to this database from your modules.
);


In your module:

// Use the secondary database we set up earlier
db_set_active('my_other_db');

// Run some queries, process some data
// ...

// Go back to the default database,
db_set_active();


2. Inside Module directly.

If your module will be alone in using the secondary database you can define the connection directly in your module:

  $other_database = array(
      'database' =&gt; 'databasename',
      'username' =&gt; 'username', // assuming this is necessary
      'password' =&gt; 'password', // assuming this is necessary
      'host' =&gt; 'localhost', // assumes localhost
      'driver' =&gt; 'mysql', // replace with your database driver
  );
  // replace 'YourDatabaseKey' with something that's unique to your module
  Database::addConnectionInfo('YourDatabaseKey', 'default', $other_database);
  db_set_active('YourDatabaseKey');

  // execute queries here

  db_set_active(); // without the paramater means set back to the default for the site
  drupal_set_message(t('The queries have been made.'));


Refer https://www.drupal.org/docs/7/creating-custom-modules/howtos/how-to-connect-to-multiple-databases-within-drupal