Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I made a job where I took data from source and dumped into destination. To make my job dynamic I created two db connection metadata and added there connection in tdboutput.
dev destination database is the db connection metadata where I've mentioned all the credentials of the db and xyz is the table name.
Now I created an another job where I dragged my job and tried to run it. While running it gave an error that
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "conn_tDBOutput_2" is null
To solve this when I manually wrote all credential of my db in
tDBOutput_2 instead of using dev destination database db connection it worked fine without showing any error.
Is this any bug where job is not able to use db connection or am I making some mistake?
Hi
Make sure the DB connection is created before it is used, we usually use tPreJob to perform some initialization operations such as creating DB connection in the beginning of job. eg:
tPreJob--oncomponentok--tDBConnection
....main-->tDBOutput
Regards
Shong
Hi
Make sure the DB connection is created before it is used, we usually use tPreJob to perform some initialization operations such as creating DB connection in the beginning of job. eg:
tPreJob--oncomponentok--tDBConnection
....main-->tDBOutput
Regards
Shong
Thank you @Shicong Hong. It worked.
Great, thanks for your feedback!