I am trying to communicate with a database in my module. From what I’ve heard, the easiest way to connect is to add the sqljdbc4.jar to the projects build path and then connect in the following way:
con = DriverManager.getConnection(host, userName, password);
Statement stmt = con.createStatement();
However when I load my module into ignition I receive the following error:
Searching up the error I discovered it’s an issue with the CLASSPATH environment variable, so I set the classpath to the appropriate value (.;[path to the sqljdbc4.jar]) but I still get the same error.
if I remove the “Class.forName” statement the error becomes:
java.lang.Exception: java.sql.SQLException: No suitable driver found for [database connect string]
I know my “host” “userName” and “password” variables are correct since I was able to successfully add and connect the database to ignition database connections using the same info. The only reason I can think of for this is that somehow the sqljdbc4.jar is not being discovered properly? Or is there some other setting I need to change in ignition for this to work?