diff --git a/includes/database/database.inc b/includes/database/database.inc
index 6e40b27..9d3896b 100644
--- a/includes/database/database.inc
+++ b/includes/database/database.inc
@@ -194,7 +194,7 @@
 
   /**
    * The key representing this connection.
-   * 
+   *
    * The key is a unique string which identifies a database connection. A
    * connection can be a single server or a cluster of master and slaves (use
    * target to pick between master and slave).
@@ -300,6 +300,14 @@
     // Because the other methods don't seem to work right.
     $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
 
+    // begin cgedit
+    // If any driver options have been specified in the connection options,
+    // they take precedence over any options we have set beforehand.
+    if (!empty($this->connectionOptions['driver options'])) {
+      $driver_options = $this->connectionOptions['driver options'] + $driver_options;
+    }
+    // end cgedit
+
     // Call PDO::__construct and PDO::setAttribute.
     parent::__construct($dsn, $username, $password, $driver_options);
 
@@ -307,6 +315,16 @@
     if (!empty($this->statementClass)) {
       $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
     }
+
+    // begin cgedit
+    // If any pdo attributes have been specified in the connection options,
+    // enforce them now.
+    if (!empty($this->connectionOptions['pdo attributes'])) {
+      foreach ($this->connectionOptions['pdo attributes'] as $attribute => $value) {
+        $this->setAttribute($attribute, $value);
+      }
+    }
+    //end cgedit
   }
 
   /**
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index d8ab0e6..3b451ca 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -79,6 +79,29 @@
  * varies by driver.  For MySQL, the default is FALSE since MyISAM tables
  * do not support transactions.
  *
+ *** begin cgedit ***
+ * Drupal database layer is based on PDO, you can pass any arbitrary driver
+ * option that is supported by the database engine by passing them to the
+ * 'driver options' array. The keys of this array are driver names, values
+ * are the corresponding values. You can also set arbitrary PDO attributes
+ * that will be enforced when the connection to the database is established
+ * using the 'pdo attributes' array with the same format:
+ * @code
+ * 'pdo attributes' => array(
+ *   // Set the timeout to 1 second, instead of the default 30 seconds.
+ *   PDO::ATTR_TIMEOUT => 1,
+ * ),
+ * 'driver options' => array(
+ *   MYSQL_ATTR_SSL_KEY => '/path/to/key.pem',
+ *   MYSQL_ATTR_SSL_CERT => '/path/to/cert.pem',
+ *   MYSQL_ATTR_SSL_CA => '/path/to/ca-cert.pem',
+ *   // Optional
+ *   MYSQL_ATTR_SSL_CAPATH => '/ca/path',
+ *   MYSQL_ATTR_SSL_CIPHER => 'ssl cipher',
+ * ),
+ * @endcode
+ *** end cgedit ***
+ *
  * For each database, you may optionally specify multiple "target" databases.
  * A target database allows Drupal to try to send certain queries to a
  * different database if it can but fall back to the default connection if not.
@@ -111,6 +134,18 @@
  *   'host' => 'localhost',
  *   'prefix' => 'main_',
  *   'collation' => 'utf8_general_ci',
+ *   // begin cgedit
+ *   'pdo attributes' => array(
+ *     // Set the timeout to 1 second, instead of the default 30 seconds.
+ *     PDO::ATTR_TIMEOUT => 1,
+ *   ),
+ *   // For SSL Connection
+ *   'driver options' => array(
+ *     MYSQL_ATTR_SSL_KEY => '/path/to/key.pem',
+ *     MYSQL_ATTR_SSL_CERT => '/path/to/cert.pem',
+ *     MYSQL_ATTR_SSL_CA => '/path/to/ca-cert.pem',
+ *   ),
+ *   // end cgedit
  * );
  * @endcode
  *
@@ -149,7 +184,7 @@
  *     'sessions'  => 'shared.',
  *     'role'      => 'shared.',
  *     'authmap'   => 'shared.',
- *   );
+ *   ),
  * @endcode
  * NOTE: MySQL and SQLite's definition of a schema is a database.
  *
@@ -186,6 +221,22 @@
  *     'host' => 'localhost',
  *     'prefix' => '',
  *   );
+ *   // begin cgedit
+ *   // mysql with SSL
+ *   $databases['default']['default'] = array(
+ *     'driver' => 'mysql',
+ *     'database' => 'databasename',
+ *     'username' => 'username',
+ *     'password' => 'password',
+ *     'host' => 'localhost',
+ *     'prefix' => '',
+ *     'driver options' => array(
+ *       MYSQL_ATTR_SSL_KEY => '/etc/ssl/mysql/key.pem',
+ *       MYSQL_ATTR_SSL_CERT => '/etc/ssl/mysql/cert.pem',
+ *       MYSQL_ATTR_SSL_CA => '/etc/ssl/mysql/ca-cert.pem',
+ *     ),
+ *   );
+ *   // end cgedit
  *   $databases['default']['default'] = array(
  *     'driver' => 'pgsql',
  *     'database' => 'databasename',
