Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Make SQL server connection using zxJDBC

Rising Star

I am trying to make a conenction to my Sql Server using "zxJDBC". Below is my code in ExecuteScript processor:

from com.ziclix.python.sql import zxJDBC
d, u, p, v = "jdbc:sqlserver://<servername>;Database=<databasename>;encrypt=true;trustServerCertificate=true;user=<username>;password=<password>;integratedSecurity=true", None, None, ""

db = zxJDBC.connect(d, u, p, v)
c = db.cursor()

However, I am getting an error " zxjdbc.database error driver not found" 
My limted research in internet found out that it is dependent on some jar files how how can we add jar files classpath in nifi processors.  Please guide in making this Sql server connection successful.




@Kiranq   Why are you using ExecuteScript?  You can setup a DBCP (DataBaseConnectionPool) controller service with your sql connection and driver file. Make sure that jdbc driver is found on all nifi hosts.   Then, you are able to use any processors that reference a DBCP Controller Service.  For example:  ExecuteSql.