mirror of
https://github.com/hwchase17/langchain.git
synced 2025-12-21 14:54:21 +00:00
The outer try/except block handles connection errors, and the inner
try/except block handles SQL execution errors, providing detailed error
messages for both.
try:
conn = oracledb.connect(user=username, password=password, dsn=dsn)
print("Connection successful!")
cursor = conn.cursor()
try:
cursor.execute(
"""
begin
-- Drop user
begin
execute immediate 'drop user testuser cascade';
exception
when others then
dbms_output.put_line('Error dropping user: ' || SQLERRM);
end;
---------
Co-authored-by: Chester Curme <chester.curme@gmail.com>
37 KiB
37 KiB