Welcome Guest, Not a member yet? Register   Sign In
new to CI, need advice on db connections
#1

Hi all,
as said, I'm a CI newbie, but have some experience on php/other frameworks, and programming in general.
my test app runs on a typical lamp stack, atm.

In CI's config/database.php, I have set a dsn, and it works. I tried a simple model and I get my data through the view, nicely,
but it seems that (nearly?) every page refresh opens a new mysql process, and I would like it to reuse the same connecion instead.

I guess this needs some configuration, somewhere: what are the steps needed to make the connection survive longer, that I am missing?
What are the topics to look for in the docs, or elsewhere?

here's the current dsn

$db['default'] = array(
        'dsn'   => 'mysql',
        'hostname' => '192.168.x.y',
        'username' => 'username',
        'password' => 'password',
        'database' => 'dbname',
        'dbdriver' => 'mysqli',
        'dbprefix' => '',
        'pconnect' => TRUE,
        'db_debug' => (ENVIRONMENT !== 'production'),
        'cache_on' => FALSE,
        'cachedir' => '',
        'char_set' => 'utf8',
        'dbcollat' => 'utf8_general_ci',
        'swap_pre' => '',
        'encrypt' => FALSE,
        'compress' => FALSE,
        'stricton' => FALSE,
        'failover' => array(),
        'save_queries' => TRUE
)

Thanks,
Marco
Reply


Messages In This Thread
new to CI, need advice on db connections - by m.ardito - 03-29-2016, 04:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB