ServiceStack OrmLite:MySQL 连接池
ServiceStack OrmLite: MySQL connection pool
我明白这个话题并不新鲜,我看了几个帖子但没有得出答案...
每次打开连接都要很长时间,不过当时的想法是用连接池是吧?
据我了解 MySQL 您不能在连接字符串中指定连接池。
如何做正确的事情而不是花费大量时间打开数据库连接?
谢谢!
IDbConnectionFactory = connection = new OrmLiteConnectionFactory(TeleportParams.DbConnectionStr, MySqlDialectProvider.Instance)
...
void function1(){
var db = connection.Open();
db.Select("some request");
}
void function2(){
var db = connection.Open();
db.Select("some request");
}
...
function1();
function2();
As I understand it in MySQL you cannot specify a connection pool in the connection string.
您可以将 pooling=false
添加到 disable Connection Pooling in MySql 的连接字符串中。
我明白这个话题并不新鲜,我看了几个帖子但没有得出答案...
每次打开连接都要很长时间,不过当时的想法是用连接池是吧?
据我了解 MySQL 您不能在连接字符串中指定连接池。
如何做正确的事情而不是花费大量时间打开数据库连接?
谢谢!
IDbConnectionFactory = connection = new OrmLiteConnectionFactory(TeleportParams.DbConnectionStr, MySqlDialectProvider.Instance)
...
void function1(){
var db = connection.Open();
db.Select("some request");
}
void function2(){
var db = connection.Open();
db.Select("some request");
}
...
function1();
function2();
As I understand it in MySQL you cannot specify a connection pool in the connection string.
您可以将 pooling=false
添加到 disable Connection Pooling in MySql 的连接字符串中。