lua-resty-mysql icon indicating copy to clipboard operation
lua-resty-mysql copied to clipboard

Have some questions in db:connect

Open gaoyue1989 opened this issue 10 years ago • 1 comments

Like an example,is each http request creates a new connection, or to check is have a pool. If have a pool,use it .if not create a pool

local ok, err, errno, sqlstate = db:connect{
                    host = "127.0.0.1",
                    port = 3306,
                    database = "ngx_test",
                    user = "ngx_test",
                    password = "ngx_test",
                    max_packet_size = 1024 * 1024 }  

gaoyue1989 avatar Jul 24 '15 12:07 gaoyue1989

@gaoyue1989 To quote the official documentation for the connect method:

Before actually resolving the host name and connecting to the remote backend, this method will always look up the connection pool for matched idle connections created by previous calls of this method.

See https://github.com/openresty/lua-resty-mysql#connect

BTW, general questions should go to the openresty-en mailing list instead. Please see https://openresty.org/#Community Thanks for your cooperation!

agentzh avatar Jul 24 '15 13:07 agentzh