JDBC driver becoming stale in JVM?
35 views (last 30 days)
Show older comments
I connect to a database using:
JDBCDriverClass = 'org.teiid.jdbc.TeiidDriver';
JDBCDriverWildcard = 'teiid-*-jdbc.jar';
% Find latest JDBC binary
teiidfiles = dir(fullfile('path:)', JDBCDriverWildcard));
latest_driver = fullfile(teiidfiles(1).folder, teiidfiles(1).name);
% Only add to Java class path if not already present
if ~any(strcmpi(latest_driver, javaclasspath('-dynamic')))
javaaddpath(latest_driver);
end
conn = database('', Username, Password, JDBCDriverClass, sprintf(URLFormat, Version, Server, Port, AccessKey, options.timeout));
c = oncleanup(@() close(conn))
... rest of code
this works fine for ~8-24 hours, but after that I get this error:
Error using database (line 59)
One or more output arguments not assigned during call to "getDatabaseConnection".
I have tried to remove the driver from my java dynamic path, add it, and run it again, but that does not fix it, clear java, and clear classes also don't fix the issue.
the only solution I have found is restarting Matlab (which is not always handy since this is supposed to run on a VDI machine and query stuff daily)
0 Comments
Answers (0)
See Also
Categories
Find more on Call Java from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!