Does anyone know how to find the classname for the JDBC MS Sql Server driver? When I run this code I get a driver not found error.
from com.ziclix.python.sql import zxJDBC, Procedure
# #create database connection
db = zxJDBC.connect("jdbc:sqlserver://10.15.4.246\SQLEXPRESS", "sa", "NTH", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
Where are you trying to run this code?
In the Project Script Library
Sure, but from what context are you calling the script? Client/Designer (a button, etc…)?
JDBC drivers are only going to be on the classpath in the gateway scope.
Sorry, calling it from a button on a client. (Though I would eventually need to call it from a client event script.)
So would it need to be in the “shared” scripts instead?
No, what’s important is that you call it in such a way that it’s running on the gateway. Think tag change script, gateway timer script, message handler +
system.util.sendMessage, etc. You can’t access a database using JDBC drivers from the client.
What you should be doing is just making a DB connection in Ignition and using the standard