notebookvb
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Test pripojeni k Firebird databazi na REPORTER"""
|
||||
|
||||
import sys
|
||||
|
||||
print("=== Test pripojeni k Firebird na REPORTER ===\n")
|
||||
|
||||
# 1. Zkontroluj fdb
|
||||
try:
|
||||
import fdb
|
||||
print("+ fdb je nainstalovan")
|
||||
except ImportError as e:
|
||||
print(f"- fdb neni nainstalovan: {e}")
|
||||
print(" Instalace: pip install fdb")
|
||||
sys.exit(1)
|
||||
|
||||
# 2. Zkus pripojeni
|
||||
print("\nPokus o pripojeni k databazi...")
|
||||
print(" dsn: reporter:c:\\medicus\\medicus.fdb")
|
||||
print(" user: SYSDBA")
|
||||
print(" charset: win1250\n")
|
||||
|
||||
try:
|
||||
conn = fdb.connect(
|
||||
dsn=r'reporter:c:\medicus\medicus.fdb',
|
||||
user='SYSDBA',
|
||||
password='masterkey',
|
||||
charset='win1250'
|
||||
)
|
||||
print("+ Pripojeni se podarilo!")
|
||||
|
||||
# Testovaci SELECT
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Jednoducky test - zjisti verzi Firebirdu
|
||||
cursor.execute("SELECT RDB$GET_CONTEXT('SYSTEM', 'ENGINE_VERSION') FROM RDB$DATABASE")
|
||||
version = cursor.fetchone()[0]
|
||||
print(f"+ Firebird verze: {version}")
|
||||
|
||||
# Zjisti kolik je tabulek
|
||||
cursor.execute("SELECT COUNT(*) FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG = 0")
|
||||
table_count = cursor.fetchone()[0]
|
||||
print(f"+ Pocet uzivatelskych tabulek: {table_count}")
|
||||
|
||||
conn.close()
|
||||
|
||||
print("\n" + "="*60)
|
||||
print("SUCCESS: Databaze na REPORTER je dostupna a funguje!")
|
||||
print("="*60)
|
||||
print("\nMuzete pouzit:")
|
||||
print(" conn = fdb.connect(")
|
||||
print(" dsn=r'reporter:c:\\medicus\\medicus.fdb',")
|
||||
print(" user='SYSDBA',")
|
||||
print(" password='masterkey',")
|
||||
print(" charset='win1250'")
|
||||
print(" )")
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n- Chyba: {type(e).__name__}")
|
||||
print(f" {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user