我在Xeround上试验SQLAlchemy:
>>> from sqlalchemy import create_engine
>>> engine = create_engine("mysql://user:pass@instance0000.db.xeround.com.:1234/app000000")
>>> engine.execute("SELECT USER()").scalar()
>>> exit()
我这样做了几次。然后我检查了我的Xeround管理仪表板,它显示了2个连接。那是在我了解之前:
>>> engine = create_engine("mysql://user:pass@instance0000.db.xeround.com.:1234/app000000")
>>> conn = engine.connect() # dashboard shows 3 connections
>>> conn.close() # dashboard still shows 3 connections
>>> exit() # after exiting, dashboard shows 2 connections
如何强制Xeround关闭剩余的2个连接(例如,原谅我忘记关闭它们)?
答案 0 :(得分:0)
如何强制Xeround关闭剩余的2个连接(例如,原谅我忘记关闭它们)?
如果重新启动mysql服务,则所有功能都会像魅力一样再次运行,因为您的连接未正确关闭。 在这种情况下,您需要使用A Connection Pool