Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Just_learner
Contributor
Contributor

why am I getting conn_tDBOutput is null error

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.

0695b00000smTASAA2.png

dev destination database is the db connection metadata where I've mentioned all the credentials of the db and xyz is the table name.

0695b00000smTA4AAM.png

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?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

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

 

View solution in original post

3 Replies
Anonymous
Not applicable

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

 

Just_learner
Contributor
Contributor
Author

Thank you @Shicong Hong​. It worked.

Anonymous
Not applicable

Great, thanks for your feedback!