11-03-2014 05:04 AM - edited 03-14-2019 02:03 PM
Hi,
We have UCCX 10 integrating with Oracle DB and the customer wants to run certain SQL statement at DB read step and add the result it directly in string variable on UCCX without using DB get step because the result of this SQL statement is not searching in table, it acts as equation and returns digits into string.
Can this be done or I need other way for doing this.
Thanks
Haitham,
Solved! Go to Solution.
11-03-2014 06:05 AM
I see. You have the following options then:
1. Create a database table with one column ("bal") with the correct datatype. Feed it to the Get DB Read step.
2. Use a HTTP-to-DB proxy service, as described here.
3. Upload the Oracle JDBC driver to the UCCX server and use a Java code block in a Set/Do step.
G.
11-03-2014 05:22 AM
Hi,
I don't get this. You say the query returns something ("into string"). Now why can't you use the DB Get step then? Can you tell me what sort of request is that? A stored procedure perhaps?
G.
11-03-2014 05:42 AM
Hi Gergely,
The SQL statement in DB read step doesn't returns rows because this statement is not searching the database table so, there is no tables found in DB get set.
the SQL statement as below, we need the result of it(bal) to be filled in UCCX string variable directly.
select ivr_package.ivr_cust_balance ($ivr_cust_id ) bal from dual
Thanks
11-03-2014 06:05 AM
I see. You have the following options then:
1. Create a database table with one column ("bal") with the correct datatype. Feed it to the Get DB Read step.
2. Use a HTTP-to-DB proxy service, as described here.
3. Upload the Oracle JDBC driver to the UCCX server and use a Java code block in a Set/Do step.
G.
11-03-2014 06:23 AM
Hi Gergely,
Thank you for your support.
Regarding the first choice, i have suggested it to the customer but he refused it.
I think 3rd choice is the best one but it needs Java developer for making Java code in Set step.
11-03-2014 06:50 AM
Hi,
actually, it's not that difficult. What is the data type of the value returned by the database server? Also, can you please tell me the version and license type of your UCCX?
G.
11-03-2014 07:15 AM
Hi,
The returned value is digits and UCCX version 10.5.
If you can help me for the knowing the Java code at Set step will be great.
Thanks
11-03-2014 07:29 AM
Could you check the UCCX license for me please (Standard, Enhanced, Premium or IP IVR).
G.
11-03-2014 07:52 AM
Premium.
11-03-2014 07:59 AM
Okay.
Have you downloaded the Oracle JDBC Driver package yet and if not, do you have access to the Oracle Developer Network? If not, please register and download it from here.
Also, please make sure you have all the necessary information such as the SID, the username, the password and the schema name.
G.
11-03-2014 08:27 AM
Hi Gergely,
I have integrated with oracle DB with JDBC driver from Oracle already and i can get information from the tables.
Thanks
11-03-2014 11:19 AM
Hi,
okay, so you need to upload the driver jar file to the Classpath of the UCCX server (check the documentation) and restart UCCX.
You did not say too much about that stored function, so I just created a simplistic one, like this:
Then I added the following variables to my UCCX script:
Or, if you prefer a screenshot:
Then I just inserted a Set step (setting the value of the variable input to "33333"), followed by yet another Set step which assigns the value of output and contains the following code block:
{
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPass);
java.sql.CallableStatement callableStatement = connection.prepareCall(jdbcStatement);
callableStatement.setQueryTimeout(5000);
callableStatement.registerOutParameter(1, java.sql.Types.VARCHAR);
callableStatement.setString(2, input);
callableStatement.executeQuery();
String output =callableStatement.getString (1);
return output;
}
Naturally, you may enhance this with an exception handling mechanism.
Now if you run this and the DB server is available, after the second Set step the value of the output variable is "12345":
G.
11-04-2014 04:29 AM
Hi Gergely,
Actually, I didn't understand where I will configure the below part, knowing that UCCX is integrating with Oracle DB 11g release 2 and the SQL statement for retrieving select ivr_package.ivr_cust_balance ($ivr_cust_id ) bal from dual,
this statement should return the balance of the customer by his id.
At jdbcstatement string, Shall i add the previous SQL statement to get the balance
11-04-2014 10:48 AM
Hi,
er... you wrote you had already done some integration with JDBC.
Anyway, to answer your question, no, the above stuff with the SQL create or replace function is just my pretend DB function to demonstrate that the Java code in my UCCX script works.
I assume your DB function takes one parameter and returns one value - is this correct? If so, you need to change the initial value of jdbcStatement to
"{ ? = ivr_package.ivr_cust_balance(?) }"
And if the input parameter value is stored in the local variable named ivr_cust_id then the code block of the Set step would be:
{
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPass);
java.sql.CallableStatement callableStatement = connection.prepareCall(jdbcStatement);
callableStatement.setQueryTimeout(5000);
callableStatement.registerOutParameter(1, java.sql.Types.VARCHAR);
callableStatement.setString(2, ivr_cust_id);
callableStatement.executeQuery();
String output =callableStatement.getString (1);
return output;
}
I hope that helps.
G.
11-05-2014 02:47 AM
Hi Gergely,
Thank you so much for your help, I will try the java code.
regarding your question:
I assume your DB function takes one parameter and returns one value - is this correct?
yes, the input is the customer id.
Thanks
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