in sql-private-pool/app.py [0:0]
def main():
try:
db = connect_db()
with db.connect() as conn:
if db_type == "mssql":
now_stmt = "SELECT getdate() as now"
else:
now_stmt = "SELECT NOW() as now"
now = conn.execute(sqlalchemy.text(now_stmt)).scalar()
return render_template(
"index.html",
success=True,
message=f"Successful connection. Database Time: {now}",
)
except Exception as e:
return (
render_template(
"index.html", success=False, message=f"Connection not successful: {e}"
),
500,
)