Surya \’s Blog

… ever streaming tools and technologies….!!!

New Location of this Blog

Posted by kathayat on March 5, 2012

http://www.suryakathayat.com/blog/ is the new location. See you there….

Advertisements

7 Responses to “New Location of this Blog”

  1. i will see

  2. Bibek said

    visit Nepal Beauty to get more information about Nepal and its beauty.

  3. ok

  4. Surya said

    public class CommonDbUtils {

    public static int STATUS_QUEUED = 0;
    public static int STATUS_DISPATCHED = 1;
    public static int STATUS_RUNNING = 2;
    public static int STATUS_EXECUTED = 3;

    private static int MSSQL = 1;
    private static int MYSQL = 2;

    static int dbType = MYSQL;

    private static String MSSQL_DRIVERCLASS = “com.microsoft.sqlserver.jdbc.SQLServerDriver”;
    private static String MSSQL_CONNSTR = “jdbc:sqlserver://10.55.160.209:1433;databaseName=mumla_db;selectMethod=cursor”;

    private static String MYSQL_DRIVERCLASS = “com.mysql.jdbc.Driver”;
    private static String MYSQL_CONNSTR = “jdbc:mysql://localhost:3306/mumla_db?” + “user=root&password=abcd1234”;

    public static List getPendingItems(Connection con) {
    PreparedStatement psSelect = null;
    PreparedStatement psUpdate = null;
    List queue = new ArrayList();

    try {
    boolean autoComit= con.getAutoCommit();

    con.setAutoCommit(false);
    psSelect = con.prepareStatement(“SELECT * FROM MLA_TASKS_QUEUE WHERE QSTATUS=0 limit 50”);
    ResultSet rs = psSelect.executeQuery(); // read from database

    psUpdate = con.prepareStatement(“UPDATE MLA_TASKS_QUEUE SET QSTATUS=? WHERE TASKID=?”);

    while(rs.next()){
    Integer taskId = rs.getInt(“TASKID”);
    String name = rs.getString(“TASKNAME”);
    String status = rs.getString(“QSTATUS”);
    queue.add(new BasicTask(taskId, name));

    psUpdate.setInt(1, STATUS_DISPATCHED);
    psUpdate.setInt(2, taskId);
    psUpdate.addBatch();
    }
    psUpdate.executeBatch();

    con.commit();
    con.setAutoCommit(autoComit);

    return queue;
    }
    catch (Exception e) {
    System.out.println(“ERROR executing query: “);
    e.printStackTrace();
    }
    finally{
    try {
    psSelect.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }

    return new ArrayList();
    }

    public static void updateQueueItemStatus(Connection con, int aStatus, int aTaskId) {
    PreparedStatement ps = null;

    try {
    ps = con.prepareStatement(“UPDATE MLA_TASKS_QUEUE SET QSTATUS=? WHERE TASKID=?”);
    ps.setInt(1, aStatus);//currStatus+1);
    ps.setInt(2, aTaskId);
    ps.executeUpdate(); // executes the insert query

    }
    catch (Exception e) {
    System.out.println(“ERROR executing query: “);
    e.printStackTrace();
    }
    finally {
    try {
    //close the statement
    ps.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    }

    public static boolean updateWorkflow(Connection con, ExecutorThread aExecutedTask){
    boolean result = false;
    PreparedStatement psWorkflow = null;
    PreparedStatement psQueue = null;
    ResultSet rs = null;
    try {
    boolean autoComit= con.getAutoCommit();
    con.setAutoCommit(false);

    psWorkflow = con.prepareStatement(“SELECT * FROM MLA_TASKS_WORKFLOWS WHERE SRC_ID=?”);
    psWorkflow.setInt(1, aExecutedTask.getId());
    rs = psWorkflow.executeQuery();
    ExecutorThread newTask = null;
    while(rs.next()){
    Integer srcId = rs.getInt(“SRC_ID”);
    Integer targetId = rs.getInt(“TAR_ID”);
    newTask = new ExecutorThread(targetId, “task ” + targetId, null);
    }

    if(newTask !=null){
    psQueue = con.prepareStatement(“INSERT into MLA_TASKS_QUEUE (taskid,taskname,qstatus) values(?,?,?);”);
    psQueue.setInt(1, newTask.getId());
    psQueue.setString(2, newTask.getName());
    psQueue.setInt(3, STATUS_QUEUED);
    psQueue.executeUpdate(); // executes the insert query
    }

    con.commit();
    con.setAutoCommit(autoComit);

    return true;
    }
    catch (Exception e) {
    }
    finally {
    try {
    rs.close();
    } catch (SQLException e) {
    }
    try {
    psQueue.close();
    } catch (SQLException e) {
    }
    try {
    psWorkflow.close();
    } catch (SQLException e) {
    }
    }

    return result;
    }

    public static void insertIntoTasksQueue(Connection con, ExecutorThread aExecutorTask) {
    PreparedStatement ps = null;

    try {
    boolean autoComit= con.getAutoCommit();
    con.setAutoCommit(false);

    ps = con.prepareStatement(“INSERT into MLA_TASKS_QUEUE (taskid,taskname,qstatus) values(?,?,?);”);
    ps.setInt(1, aExecutorTask.getId());
    ps.setString(2, aExecutorTask.getName());
    ps.setInt(3, STATUS_QUEUED);
    ps.executeUpdate(); // executes the insert query

    con.commit();
    con.setAutoCommit(autoComit);
    }
    catch (Exception e) {
    System.out.println(“ERROR executing query: “);
    e.printStackTrace();
    }
    finally {
    try {
    //close the statement
    ps.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    }

    public static ExecutorThread getTextTaskInWorkflow(Connection con, ExecutorThread linkSourceTask) {
    PreparedStatement ps = null;
    try {
    ps = con.prepareStatement(“SELECT * FROM MLA_TASKS_WORKFLOWS WHERE SRC_ID=?”);
    ps.setInt(1, linkSourceTask.getId());
    ResultSet rs = ps.executeQuery();
    while(rs.next()){
    Integer srcId = rs.getInt(“SRC_ID”);
    Integer targetId = rs.getInt(“TAR_ID”);
    return new ExecutorThread(targetId, “task ” + targetId, null);
    }
    }
    catch (Exception e) {
    System.out.println(“ERROR executing query: “);
    e.printStackTrace();
    }
    finally{
    try {
    ps.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    return null;
    }

    }

  5. Surya said

    package com.mumla.wf.common;

    import java.io.FileInputStream;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.Properties;

    import javax.sql.DataSource;
    import org.apache.commons.dbcp.BasicDataSource;

    public class DataSourceFactory {

    private static DataSourceFactory instance;

    private DataSourceFactory(){
    }

    public static DataSourceFactory getInstance(){
    if(instance==null){
    instance = new DataSourceFactory();
    return instance;
    }
    else{
    return instance;
    }
    }

    public static Connection getConnection() throws SQLException{

    return getInstance().getDataSource(“mysql”).getConnection();
    }

    private static DataSource getDataSource(String dbType){
    Properties props = new Properties();
    FileInputStream fis = null;
    BasicDataSource dataSource = new BasicDataSource();
    try {
    fis = new FileInputStream(“db.properties”);
    props.load(fis);
    }catch(IOException e){
    e.printStackTrace();
    return null;
    }
    if(“mysql”.equals(dbType)){
    dataSource = new BasicDataSource();
    try {
    dataSource.setDriverClassName(props.getProperty(“MYSQL_DB_DRIVER_CLASS”));
    dataSource.setUrl(props.getProperty(“MYSQL_DB_URL”));
    dataSource.setUsername(props.getProperty(“MYSQL_DB_USERNAME”));
    dataSource.setPassword(props.getProperty(“MYSQL_DB_PASSWORD”));
    dataSource.setMaxActive(100);
    dataSource.setMaxWait(10000);
    dataSource.setMaxIdle(10);
    } catch (Exception e) {
    System.out.println(“***Connection Requisition*** Could not connect to the database msg :” + e.getMessage());
    }
    }else if(“oracle”.equals(dbType)){
    dataSource.setDriverClassName(props.getProperty(“ORACLE_DB_DRIVER_CLASS”));
    dataSource.setUrl(props.getProperty(“ORACLE_DB_URL”));
    dataSource.setUsername(props.getProperty(“ORACLE_DB_USERNAME”));
    dataSource.setPassword(props.getProperty(“ORACLE_DB_PASSWORD”));
    }else{
    return null;
    }

    return dataSource;
    }

    }

  6. Surya said

    #mysql DB properties
    MYSQL_DB_DRIVER_CLASS=com.mysql.jdbc.Driver
    MYSQL_DB_URL=jdbc:mysql://localhost:3306/mumla_db
    MYSQL_DB_USERNAME=administrator
    MYSQL_DB_PASSWORD=abcd1234

  7. An outbound call center is a business activity where a collection of call center agents make outgoing calls to prospective or existing customers. This activity is usually technology enabled – typically using a predictive dialer – so that large numbers of calls can be made per hour. The outbound call center mostly provide this type of services, informing of delays, problems, delivery arrangements, Sales calls to new customers, Renewals, Cross-selling or upselling sales calls to existing customers, Debt collection, Customer satisfaction surveys, Market research, Appointment booking and so on.

    You can find many companies are providing call center services for different purposes. Thakur international is one company which has been heavy experience about the Call center services. If you want to provide call center service for your customer and promote your business please you can contact with Thakur International. You can visit this site http://www.thakurintl.com also.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: