Connecting to multiple databases of different type for form submission I'm developing a GIS mapping system and for that I am using pgSQL, however I am bounded to using mysql for the drupal install because we use Drupal 6 mulitsites using mysql already.  I know I can get around this problem by hard coding using php, html to create my forms that submit to this. I know from Drupal Community Documentation this is not possible as standard. Is it possible via any other method to utilise the Form API and submit to an external DB in a different structure such as pgsql? or do i continue coding my forms by hand for each node?

The example below is exactly what I would like to do however it is clearly shown in the link above that this will not work.

// ... header of the settings.php file

$db_url = array (
"default" =&gt; "mysql://user:pass@host/db",
"second" =&gt; "pgsql://user:pass@host/db"
);


The code below is from the Form API getting started doc, however it doesnt specify the databse it is actually connecting to? 

function test_myform_submit($form, &amp;$form_state) {
 db_query("INSERT INTO {table} (name, log, hidden) VALUES ('%s', %d, '%s')",
   $form_state['values']['name'],
   $form_state['values']['access']['log'],
   $form_state['values']['hidden']);
drupal_set_message(t('Your form has been saved.'));
}
In Drupal 6 you cannot use more than one database engine with Drupal's functions. If you are using MySQL as Drupal storage, to connect to PostgreSQL you need to directly call PDO:

try {
  $dbh = new PDO('pgsql:host=localhost;port=5432;dbname=testdb;user=bruce;password=mypass');
} catch (PDOException $e) {
  watchdog("your module name",
           "PDO error: %error",
           array("%error" =&gt; $e-&gt;getMessage() ),
           WATCHDOG_ERROR);
}


Then use your handler just as you would in any non-Drupal PHP code, preferably with prepared statements.