pyreportjasper
pyreportjasper copied to clipboard
Connection to Oracle databases
Connections to oracle databases keeps throwing errors : • NameError: Error fill report: Erro fill internal: java.lang.NullPointerException • NameError: Error fill report: Java package 'net' is not valid The second I can't get around.
Could you send us the full log?
Traceback (most recent call last):
File "c:*\cons_oracle.py", line 39, in
Connection dictionnary conn = { 'driver': 'oracle', 'username': 'user', 'password': ****, 'host': ****, 'schema': *****, 'port': ***', 'jdbc_driver' : "oracle.jdbc.driver.OracleDriver", 'jdbc_dir': 'ojdbc8.jar' }
try like this
Uninstall pyreportjasper
and install with
pip3 install git+https://github.com/acesseonline/pyreportjasper.git
and
conn = {
'driver': 'oracle',
'username': '****',
'password': '****',
'db_sid': '****',
'host': ****,
'port': ****',
'jdbc_driver' : "oracle.jdbc.driver.OracleDriver",
'jdbc_dir': "C:\drivers\", # Inform the folder containing the jar file
}
pyreportjasper = PyReportJasper()
pyreportjasper.config(
input_file,
output_file,
output_formats=["pdf"],
db_connection=conn,
resource="C:\drivers"
)
pyreportjasper.process_report()
Tried it, got that error : NameError: Error fill report: It was not possible to add the path C:/Users/**/Drivers to the Class Path: ERROR: java.io.IOException: Error, could not add URL to system classloader!
To help, provide more details. If possible provide the code snippet you are running and attach the jdbc .jar file
Describe A clear and concise description.
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. Linux]
- Python version [e.g. 3.8]
- Library version [e.g. 2.1.0]
- Java version [e.g. 15]
- JVM [e.g. Oracle]
Jaspersoft Studio (please complete the following information):
- Version [e.g. 6.16.0]
Additional context Add any other context about the problem here.
Hi,
I have same problem. My code..
import os
from pyreportjasper import PyReportJasper
os.environ["JAVA_HOME"] ="jvm/jdk-19.0.2/"
def advanced_example_using_database():
REPORTS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'jrxml')
input_file = os.path.join(REPORTS_DIR, 'stampaCenaA4.jrxml')
output_file = os.path.join(REPORTS_DIR, 'stampaCenaA4')
conn = {
'driver': 'oracle',
'username': '***',
'password': '***',
'host': '***',
'port': '1521',
'db_sid': '***',
'jdbc_dir': 'x:\\nenad_ws\\-- PY RAZVOJ\\StampaCena\\oracle\\',
'jdbc_driver': 'oracle.jdbc.driver.OracleDriver'
}
pyreportjasper = PyReportJasper()
pyreportjasper.config(
input_file,
output_file,
db_connection=conn,
output_formats=["pdf"],
parameters={'poj': '114', 'pbarkod':'8600043003444,8605006902987,7622210702593,9012200872739,3080216031811'},
resource="x:\\nenad_ws\\-- PY RAZVOJ\\StampaCena\\oracle",
locale='en_US'
)
pyreportjasper.process_report()
advanced_example_using_database()
Output: NameError: Error fill report: It was not possible to add the path x:\nenad_ws-- PY RAZVOJ\StampaCena\oracle\ to the Class Path: ERROR: java.io.IOException: Error, could not add URL to system classloader!
Project path..
Python ver: 3.10.7 Lib installed with pip3 install git+https://github.com/acesseonline/pyreportjasper.git - Version: 2.1.2 Java: open jdk-19.0.2 Jvm: Oracle OS: windows 11
Jaspersoft Studio: 6.20.0
I still don't know how to make this thing work. But, I had a deadline so I worked aroud it by calling a bit of python code inside Java (as it woked perfectly with python). Don't know if that helps.
I still don't know how to make this thing work. But, I had a deadline so I worked aroud it by calling a bit of python code inside Java (as it woked perfectly with python). Don't know if that helps.
Would you mind sharing your implementation?
Best Regards! Henry Gamba