import asyncio
import asyncpg

async def check_db():
    creds = [
        ("sibu", "sibu", "sibu"),
        ("postgres", "postgres", "postgres"),
        ("postgres", "postgres", "sibu"),
        ("postgres", "", "postgres"),
        ("sibu", "", "sibu"),
    ]
    
    for user, pw, db in creds:
        url = f"postgresql://{user}:{pw}@localhost:5432/{db}"
        print(f"Testing {url}...")
        try:
            conn = await asyncpg.connect(url, timeout=5)
            print(f"!!! SUCCESS with {url} !!!")
            await conn.close()
            return
        except Exception as e:
            print(f"Failed: {type(e).__name__}: {e}")

if __name__ == "__main__":
    asyncio.run(check_db())
