Answer the question
In order to leave comments, you need to log in
How to correctly escape the @ and # characters in the password when describing a URL to Oracle?
Hello.
Decided to try jaydebeapi to connect to Oracle from Python
import jpype
import jaydebeapi
jHome = jpype.getDefaultJVMPath()
PASSWORD="\"[email protected]#007\"";
connection_string="jdbc:oracle:thin:dboracle/"+PASSWORD+"@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=dbnew)))";
jpype.startJVM(jHome, '-Djava.class.path=D:\\lib\\jdbc\\ojdbc7.jar')
conn = jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
connection_string)
File "D:/Server/templates/Test/Oracle.py", line 18, in <module>
connection_string)
File "C:\Program Files\Python35\lib\site-packages\jaydebeapi\__init__.py", line 380, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "C:\Program Files\Python35\lib\site-packages\jaydebeapi\__init__.py", line 199, in _jdbc_connect_jpype
return jpype.java.sql.DriverManager.getConnection(url, *dargs)
jpype._jexception.SQLRecoverableExceptionPyRaisable: java.sql.SQLRecoverableException: Ошибка ввода/вывода: NL <b>Exception was generated TNS-04603: Синтаксическая ошибка: Непредвиденный символ "#" при синтаксическом разборе alias</b>
Answer the question
In order to leave comments, you need to log in
solved the problem like this
conn = jaydebeapi.connect('oracle.jdbc.driver.OracleDriver',
connection_string,[USERNAME,PASSWORD])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question