09-09-2011 08:23 AM - edited 03-14-2019 08:31 AM
Does somebody knows how to use (or if is posible) a UCCX DSN inside a java step?
No DN Read is being used, Database logic is scripted inside the java step.
Thanks
09-09-2011 10:59 AM
I put this together a few years ago, based on posts in the forums, but never actually used it in production:
Do {
String datasource = "AnthonyTest";
java.sql.Connection connection = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = java.sql.DriverManager.getConnection("jdbc:odbc:" + datasource);
java.sql.ResultSet sqlResultSet;
java.sql.Statement sqlStatement = null;
sqlStatement = connection.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
sqlResultSet = sqlStatement.executeQuery("SELECT field_1b FROM table_1 WHERE field_1a = 'anthony'");
mailboxExists = sqlResultSet.first();
sqlResultSet.close();
sqlStatement.close();
connection.close();
}
09-09-2011 11:06 AM
Hi Anthony
Are you creating a new DSN inside the java step or you are reusing the DSN that you create on the UCCX admin pages?
I would like to reuse the DSN that you create on the UCCX admin pages for security and and maintenance concerns.
.
Thanks
09-10-2011 08:14 AM
#!
I cannot recall specifically, but if you look at it, there is no ip address or username/password in my example, so that would suggest a DSN is being used.
Sent from Cisco Technical Support iPhone App
09-11-2011 07:31 AM
Hi Anthony
Several Problems:
1.-
Class.forName("net.sourceforge.jtds.jdbc.Driver")
UCCX can not load this class dynamically:
In UCCX the SQL Driver java class is loaded by default if you load the driver on the UCCX admin page.
(got an error when debugging the script if you declare that step)
2.-
connection = java.sql.DriverManager.getConnection("jdbc:odbc:" + datasource);
UCCX does not recognize datasource as a valid global DSN:
It is recognized as a local string variable equal to "AnthonyTest".
(UCCX does not replace the string by the DSN)
In your example did "AnthonyTest" is a DSN from the UCCX admin pages?
What version of UCCX you were using?
04-01-2020 12:06 PM
Hello @Anthony Holloway ,
I am working on a similar case and the script cant seem to find the driver. I have loaded the driver on UCCX admin page too. I have a DB read step in the same script and it works fine. Do you have any thoughts? Following is the question I posted today.
Thanks in advance.
04-01-2020 12:13 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide