19 lines
481 B
Python
19 lines
481 B
Python
import asyncio
|
|
import asyncpg
|
|
|
|
async def test_connection():
|
|
try:
|
|
conn = await asyncpg.connect(
|
|
user="servicemanager",
|
|
password="servicemanager123",
|
|
database="servicemanager",
|
|
host="postgres",
|
|
port=5432
|
|
)
|
|
print("Connection successful!")
|
|
await conn.close()
|
|
except Exception as e:
|
|
print(f"Connection failed: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_connection()) |