Make plans now to attend XMPP integration with CVP 2012/06/14 @ 10:00 AM at Cisco Live! in San Diego. ...Read More

 



Cisco Developer Network will be presenting a CDN Developer Track at Cisco Live! London the week of January 31, 2011.

We are presenting technical sessions which highlight Application Programming interfaces (APIs) and Software Developer Kits (SDKs) for Cisco technologies such as Unified Communications, IOS, and Access Routing Technologies ¿ including the new Cisco Cius ...Read More

 

Recently noticed that there have been repeated questions from our developer community complaining that they can't seem to get the beep to work with <record>. They have set the beep attribute to "true" alright, and the reference guide even says this is supported but why doesn't it work?
...Read More

 

August 01, 2006
Earlier today, as I was typing a comment in our internal issuing-tracking system, I hit backspace to correct a typo. WHAM! I go back to the previous page, and my long-winded comment is gone. Apparently I somehow left the context of the text area (did I tab, or spuriously click, or??), which causes backspace to act as a hotkey for "Back". The web browser was not very forgiving of my mistake.

Are your IVR applications forgiving? They should be.
...Read More

 

Mark Gibbs over at Network World has put together a spiffy little scoring system for customer service systems (including many criteria for IVR systems). How would callers score your IVR using Mark's guidelines? Place a call and find out, you may be surprised.
...Read More

 

If you're using JNDI to connect to your database through Tomcat, then it's possible you've had to deal with database connection pool leaks. Your code tests fine, it's been reviewed, but in load tests or in production your app is unable to acquire database connections, the pool is empty!

Fear not, there are some handy parameters which can be set in your application's XML configuration file (in tomcat/conf/Catalina/YOUR_IP/YOUR_APP.xml):
...Read More

 

Showing 6 results.
Items per Page 50
of 1

CVP Forum

« Back to Cisco-Audium Transition Forum

Help me on the class query database in CVP

Combination View Flat View Tree View
Threads [ Previous | Next ]
Dear friends,
 
I try to create a class extends to Action element. But when I do deploy, it return no result.
I want this class receive Calling Number and do the query to database (SQL as I test, later if it works I will do for another database). After query I will get Name, Address, Email of this Customer based on Calling Number (ANI).
 
Please help to take a look on my program and help me to fix it.
 
Thank you very much.
 
import com.audium.server.AudiumException;
import com.audium.server.voiceElement.ActionElementBase;
import com.audium.server.session.ActionElementData;
import java.sql.*;

/**
 * This class is called when a standard action has been configured to use a
 * Java class. Since this is a standard action element, it applies to a
 * specific application and does not have a configuration. As a result, the
 * only method needed in this class is the doAction method.
 */
public class DBLookupStandardAction extends ActionElementBase
{


class WhatIGot
{
    String ANI = null;
    String Name = null;
    String Address = null;
    String Email = null;
}

    public void doAction(String name, ActionElementData data) throws AudiumException
    {
    Connection conn = null;
    String Name = null;
    String Address = null;
    conn = connectToDatabase();
    String ani = data.getAni();
    WhatIGot whatigot = new WhatIGot();
    whatigot = QueryDatabase(conn, ani);
    Name = whatigot.Name;
    Address = whatigot.Address;
    data.setSessionData("Name",Name);
    data.setSessionData("Address",Address);
            // PUT YOUR CODE HERE.
   
    }

    private Connection connectToDatabase()
    {
    Connection conn = null;
    try
    {
      Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      conn = DriverManager.getConnection("jdbc:sqlserver://172.16.3.5:1433;DatabaseName=hcmpt","sa","");
    }
    catch (ClassNotFoundException e)
    {
      e.printStackTrace();
      System.exit(1);
    }
    catch (SQLException e)
    {
      e.printStackTrace();
      System.exit(2);
    }
    return conn;
 }


    /*Query*/
 private WhatIGot QueryDatabase(Connection conn, String ANI)
  {
    WhatIGot WhatIGot = new WhatIGot();
    try
    {
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery("SELECT prefixnos, Name, Address, Email FROM customer_info where prefixnos = ANI");

        WhatIGot.ANI        = rs.getString ("prefixnos");
        WhatIGot.Name       = rs.getString ("Name");
        WhatIGot.Address    = rs.getString ("Address");
        WhatIGot.Email      = rs.getString ("Email");

      rs.close();
      st.close();

    }

      catch (SQLException se) {
      System.err.println("Threw a SQLException creating the list of blogs.");
      System.err.println(se.getMessage());
    }
  return WhatIGot;
  }

}