notebookVb
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import psycopg2
|
||||
import sys
|
||||
|
||||
try:
|
||||
conn = psycopg2.connect(
|
||||
host="192.168.1.76",
|
||||
port=5432,
|
||||
user="vladimir.buzalka",
|
||||
password="Vlado7309208104++",
|
||||
database="postgres"
|
||||
)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT version();")
|
||||
version = cursor.fetchone()
|
||||
print("[OK] PostgreSQL pripojeni uspesne!")
|
||||
print(f"Verze: {version[0][:100]}")
|
||||
|
||||
# Test MongoDB
|
||||
try:
|
||||
from pymongo import MongoClient
|
||||
mongo_conn = MongoClient("mongodb://localhost:27017/", serverSelectionTimeoutMS=2000)
|
||||
mongo_conn.admin.command('ping')
|
||||
print("[OK] MongoDB dostupny")
|
||||
except Exception as e:
|
||||
print(f"[WARN] MongoDB: {str(e)[:50]}")
|
||||
|
||||
# Test Redis
|
||||
try:
|
||||
import redis
|
||||
redis_conn = redis.Redis(host='localhost', port=6379, socket_connect_timeout=2)
|
||||
redis_conn.ping()
|
||||
print("[OK] Redis dostupny")
|
||||
except Exception as e:
|
||||
print(f"[WARN] Redis: {str(e)[:50]}")
|
||||
|
||||
conn.close()
|
||||
except Exception as e:
|
||||
print(f"[ERROR] PostgreSQL: {e}")
|
||||
Reference in New Issue
Block a user