Support Questions

Find answers, ask questions, and share your expertise

Make SQL server connection using zxJDBC

avatar
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, "

com.microsoft.sqlserver.jdbc.SQLServerDriver"

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

However, I am getting an error " zxjdbc.database error driver com.microsoft.sqlserver.jdbc.SQLServerDriver 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.

Thanks. 

1 REPLY 1

avatar

@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.