I'm focusing on a task using Propel ORM and want for connecting to 2 different databases to retrieve certain data. I have attempted searching on the internet for any guide, but didn't have luck as all of the "solutions" were either specific to Symphony or simply simply didn't work.

I must have the ability to have two connections specified and have the ability to switch together throughout certain queries by passing an association alias towards the query. However, it's also acceptable to possess both connections open concurrently.

Every assistance is greatly appreciated!

Thanks, Dima

Based on the Propel API Docs you are able to define a database connection inside your schema.xml file in this manner:

<?xml version="1.0" encoding="UTF-8"?>
<database name="bookstore" defaultIdMethod="native">
    <!-- table definitions go here -->
</database>

Then inside your runtime-conf.xml configurations you are able to set the bond params:

<datasources default="bookstore">
  <datasource id="bookstore">
    <adapter>mysql</adapter> <!-- sqlite, mysql, mssql, oracle, or pgsql -->
    <connection>
      <dsn>mysql:host=localhost;dbname=my_db_name</dsn>
      <user>my_db_user</user>
      <password>my_db_password</password>
    </connection>
  </datasource>
</datasources>

-- Edit --

Does not appear that Propel supports an alias attribute for that database tag, however, you should have the ability to pull off the next:

<?xml version="1.0" encoding="UTF-8"?>
<database name="bookstore_primary" defaultIdMethod="native">
    <!-- table definitions go here -->
</database>

<database name="bookstore_secondary" defaultIdMethod="native">
    <!-- table definitions go here -->
</database>

<datasources default="bookstore_primary">
  <datasource id="bookstore_primary">
    <adapter>mysql</adapter> <!-- sqlite, mysql, mssql, oracle, or pgsql -->
    <connection>
      <dsn>mysql:host=localhost;dbname=bookstore_primary</dsn>
      <user>my_db_user</user>
      <password>my_db_password</password>
    </connection>
  </datasource>
</datasources>

<datasources default="bookstore_secondary">
  <datasource id="bookstore_secondary">
    <adapter>mysql</adapter> <!-- sqlite, mysql, mssql, oracle, or pgsql -->
    <connection>
      <dsn>mysql:host=localhost;dbname=bookstore_secondary</dsn>
      <user>my_db_user</user>
      <password>my_db_password</password>
    </connection>
  </datasource>
</datasources>

Find out if that actually works. In the finish during the day the one thing that actually matters is the fact that an association can be created to both databases (using particular DSNs).