Appendix B. Miscellaneous

Table of Contents

DSNs in TF context

DSNs in TF context

By default Tangra Framework uses ADOdb as database abstraction layer in order to provide applications with independence from underlaying RDBMS. Portable way of passing connection parameters to ADOdb (and many other DBAL as PDO, etc.) methods is via DSNs.

Generally speaking: DSNs provide universal mechanism to supply connection parameters for connecting to different DBs.

They are formed in following manner:

$driver://$username:$password@hostname/$database?options[=value]

Where:

  • $driver is database driver like "mysql" or "mysqlt". TF applications usually use transactions so "mysqlt" is the most common driver used.
  • $username - username of the account
  • $password - password of the account. Please note that if $password contains special symbols as /:? you have to use rawurlencode()() PHP function to encode it. If you have unexplainable “Access denied” messages when connecting to DB and you are sure that your username and passwords are correct - may be you have to rawurlencode()() your password.
  • $database - name of the database. Examples: tcc, my_db
  • options[=value] pairs - you can pass additional parameters to your database. Pairs are separates with & (ampersand). Common option used in TF applications is "persist".

Example B.1. Examples for DSNs:

mysqlt://tcc:tccpass@localhost/tcc_db?persist
mysqlt://my_user:1234@localhost/my_db?persist&port=3307
mysqlt://ogre:das239aar2@localhost/testbase?new