Hi python experts i do not know what i do wrong , I would like connect to sql by python using txt.file , Where i do a mistake? or is possible connect to sql by python so as not to be seen password and other things? Thanks Password and other thing should be saved in other folder as my python file. Is it possible thanks
dat=open(location+"udaje.txt",'r') lines=dat.readlines() p_username=lines[0] p_password=lines[1] p_host=lines[2] p_service=lines[3] p_dns=lines[4] p_port=lines[5] print(p_username) print(p_password) print(p_host) print(p_service) print(p_dns) print(p_port) #dat.close() conn=cx_Oracle.connect(user=p_username, password=p_password, dsn=p_dns) cursor = conn.cursor() rs = cursor.execute("delete FROM table") conn.commit()I get this output
Output:DatabaseError Traceback (most recent call last)
<ipython-input-11-544a4434c1b5> in <module>
37 #dat.close()
38
---> 39 conn=cx_Oracle.connect(user=p_username, password=p_password, dsn=p_dns)
40 cursor = conn.cursor()
41 rs = cursor.execute("delete FROM table")
DatabaseError: ORA-12154: TNS: nie je možné rozpoznať zadaný identifikátor pripojenia