You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -179,22 +197,21 @@ Based on security considerations, in order to prevent SQL injection, it is recom
179
197
mybatis-py maintains a cache pool for each connection. The elimination strategy isLRU. You can define the maximum byte capacity of the pool. If you do not want to use cache, you can set the parameter configuration. The code isas follows:
180
198
```python
181
199
from mybatis import*
182
-
import mysql.connector
183
200
184
201
def main():
185
-
conn1 =mysql.connector.connect(
186
-
host="localhost",
187
-
user="mybatis",
188
-
password="mybatis",
189
-
database="mybatis"
190
-
)
191
-
192
-
conn2 =mysql.connector.connect(
193
-
host="localhost",
194
-
user="mybatis",
195
-
password="mybatis",
196
-
database="mybatis"
197
-
)
202
+
conn1=ConnectionFactory.get_connection(
203
+
dbms_name='mysql', # change to 'postgresql' if you are using PostgreSQL
204
+
host="localhost",
205
+
user="mybatis",
206
+
password="mybatis",
207
+
database="mybatis")
208
+
209
+
conn2=ConnectionFactory.get_connection(
210
+
dbms_name='mysql', # change to 'postgresql' if you are using PostgreSQL
211
+
host="localhost",
212
+
user="mybatis",
213
+
password="mybatis",
214
+
database="mybatis")
198
215
199
216
mb1= Mybatis(conn1, "mapper", cache_memory_limit=50*1024*1024) # Capacity limit is 50MB
0 commit comments