cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1303
Views
0
Helpful
6
Replies

UCCX 8.5: UCCX DSN access from inside a java step

aalejo
Level 5
Level 5

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

6 Replies 6

Anthony Holloway
Cisco Employee
Cisco Employee

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();

}

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

#!

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

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?

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.

https://community.cisco.com/t5/contact-center/uccx-how-to-call-a-stored-procedure/m-p/4057009#M115722

 

Thanks in advance.

Nevermind I got it to work. I removed the Class.forname setting in the script and it worked.