# Keep a handle on your databases

- ## Connecting to a database can be slow

- ##

- ## Try to connect once and stay connected where practical

  - We'll discuss web server issues later

- ##

- ## The connect_cached() method …

  - Acts like prepare_cached() but for database handles
  - Like prepare_cached(), it’s handy for library code
  - Potentially useful with DBD::Proxy & DBI::ProxyServer
  - It also checks the connection and automatically reconnects if it's broken
  - Works well combined with prepare_cached(), see following example

## .

Previous slide | Next slide | Back to first slide | View graphic version