This discussion is archived
5 Replies Latest reply: Sep 12, 2012 8:38 AM by 961703 RSS

Example JMS/XLA please

751148 Newbie
Currently Being Moderated
Hi, I have the connection and the file jdbc jmsxla.xml configured for my connection.

What can I do to use XLA? what class should I create me?, somebody have any complete example?

Thanks.
  • 1. Re: Example JMS/XLA please
    ChrisJenkins Guru
    Currently Being Moderated
    We have some JMS/XLA demos that will be included with TimesTen as from 11.2.1.5.0. If you can give me your e-mail address I will send them to you.

    Chris

    Edited by: ChrisJenkins on Feb 6, 2010 3:26 PM
  • 2. Re: Example JMS/XLA please
    751148 Newbie
    Currently Being Moderated
    Thanks, my address is paulmorinhdez@gmail.com
    This is what I have done but did not get it to work:

                   Class.forName(timestenDriver);
                   urlConnection = directURLPrefix + INPUTDSN;
                   con = DriverManager.getConnection(urlConnection);
                   Statement stmt = con.createStatement();
                   try{
                        stmt.execute(CREATETABLE);
                   }catch(Exception e){
                   }

                   try{
                             Hashtable<String, String> env = new Hashtable<String, String>();
                             env.put(Context.INITIAL_CONTEXT_FACTORY, "com.timesten.dataserver.jmsxla.SimpleInitialContextFactory");
                             env.put(XlaConstants.CONFIG_FILE_NAME, "/se/ericsson/servicegw/timesten/jdbc/jmsxla.xml");
                             InitialContext ic = new InitialContext(env);
                             CallableStatement cs = con.prepareCall("{call ttXlaBookmarkCreate(?, ?)}");
                             cs.setString(1, "xla");
                             cs.setNull(2, Types.BINARY);
                             cs.execute();
                             CallableStatement cStmt;
                             cStmt = con.prepareCall("{call ttXlaSubscribe(?, ?)}");
                             cStmt.setString(1, "TEST");
                             cStmt.setString(2, "xla");
                             cStmt.execute();
                             ConnectionFactory connectionFactory;
                             Context messaging = new InitialContext();
                             connectionFactory = (ConnectionFactory) messaging.lookup("ConnectionFactory");
                             javax.jms.Connection connection = connectionFactory.createConnection();
                             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                             connection.start();
                             Topic xlaTopic = session.createTopic("XLATest");
                             TopicSubscriber subscriber = session.createDurableSubscriber(xlaTopic, "xla");
                             subscriber.setMessageListener(new XLAMessageListener());
                        }catch(Exception e){}

    try{
                             stmt.execute(INSERTTABLE);
    stmt.execute(UPDATETTABLE);
    stmt.execute(DELETETABLE);
                        }catch(Exception e){
                             System.out.println("Insert table ERROR:"+ e.toString());
                        }

    And this:

    public class XLAMessageListener implements MessageListener{
         public void onMessage(Message arg0) {
              System.out.println("DO IT");
         }
    }

    But nothing.
  • 3. Re: Example JMS/XLA please
    751148 Newbie
    Currently Being Moderated
    I have 2 problems:

    - java.sql.SQLException: [TimesTen][TimesTen 11.2.1.4.0 ODBC Driver][TimesTen]TT0907: Unique constraint (TRANSACTION_LOG_API.ID) violated at Rowid <BMUFVUAAAAbAAAACAK> -- file "hindex.c", lineno 2564, procedure "sbHixInsert".

    - javax.naming.NameNotFoundException: TopicConnectionFactory not bound

    Any ideas?, I am using jboss
  • 4. Re: Example JMS/XLA please
    961703 Newbie
    Currently Being Moderated
    user9094560 wrote:
    I have 2 problems:

    - java.sql.SQLException: [TimesTen][TimesTen 11.2.1.4.0 ODBC Driver][TimesTen]TT0907: Unique constraint (TRANSACTION_LOG_API.ID) violated at Rowid <BMUFVUAAAAbAAAACAK> -- file "hindex.c", lineno 2564, procedure "sbHixInsert".

    - javax.naming.NameNotFoundException: TopicConnectionFactory not bound

    Any ideas?, I am using jboss
    This is an old topic...but here is the answers.




    The first problem says that you already have the bookmark created, you need to delete the previous bookmark created.

    Run the ttisql tool and execute:

    call ttXlaBookmarkDelete('YOUR BOOKMARK NAME');*


    In the second problem, i believe that you need to provide the context factory of the xla:

    TopicConnectionFactory connectionFactory;*

    Hashtable<String, String> env = new Hashtable<String, String>();*

    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.timesten.dataserver.jmsxla.SimpleInitialContextFactory");*

    env.put(XlaConstants.CONFIG_FILE_NAME, "/jmsxla.xml");*

    Context messaging = new InitialContext(env);*

    connectionFactory = (TopicConnectionFactory) messaging.lookup("TopicConnectionFactory");*
    .
    .
    .

    Remember to put the timestenjmsxla.jar and the orai18n.jar in your classpath!

    Hugs.
  • 5. Re: Example JMS/XLA please
    961703 Newbie
    Currently Being Moderated
    user9094560 wrote:
    Thanks, my address is paulmorinhdez@gmail.com
    This is what I have done but did not get it to work:

                   Class.forName(timestenDriver);
                   urlConnection = directURLPrefix + INPUTDSN;
                   con = DriverManager.getConnection(urlConnection);
                   Statement stmt = con.createStatement();
                   try{
                        stmt.execute(CREATETABLE);
                   }catch(Exception e){
                   }

                   try{
                             Hashtable<String, String> env = new Hashtable<String, String>();
                             env.put(Context.INITIAL_CONTEXT_FACTORY, "com.timesten.dataserver.jmsxla.SimpleInitialContextFactory");
                             env.put(XlaConstants.CONFIG_FILE_NAME, "/se/ericsson/servicegw/timesten/jdbc/jmsxla.xml");
                             InitialContext ic = new InitialContext(env);
                             CallableStatement cs = con.prepareCall("{call ttXlaBookmarkCreate(?, ?)}");
                             cs.setString(1, "xla");
                             cs.setNull(2, Types.BINARY);
                             cs.execute();
                             CallableStatement cStmt;
                             cStmt = con.prepareCall("{call ttXlaSubscribe(?, ?)}");
                             cStmt.setString(1, "TEST");
                             cStmt.setString(2, "xla");
                             cStmt.execute();
                             ConnectionFactory connectionFactory;
                             Context messaging = new InitialContext();
                             connectionFactory = (ConnectionFactory) messaging.lookup("ConnectionFactory");
                             javax.jms.Connection connection = connectionFactory.createConnection();
                             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                             connection.start();
                             Topic xlaTopic = session.createTopic("XLATest");
                             TopicSubscriber subscriber = session.createDurableSubscriber(xlaTopic, "xla");
                             subscriber.setMessageListener(new XLAMessageListener());
                        }catch(Exception e){}

    try{
                             stmt.execute(INSERTTABLE);
    stmt.execute(UPDATETTABLE);
    stmt.execute(DELETETABLE);
                        }catch(Exception e){
                             System.out.println("Insert table ERROR:"+ e.toString());
                        }

    And this:

    public class XLAMessageListener implements MessageListener{
         public void onMessage(Message arg0) {
              System.out.println("DO IT");
         }
    }

    But nothing.
    You need to tell what is the user owner of the table:

    +.+
    +.+
    +.+
    *cStmt = con.prepareCall("{call ttXlaSubscribe(?, ?)}");*+
    +*cStmt.setString(1, "YOUR_USER.TEST");*+
    +*cStmt.setString(2, "xla");*+
    *+.+*
    *+.+*
    *+.+*

    And when you will run the inserts/updates etc, you have to connect to the instance with the same user:

    *+ttisql --connStr "DSN=YOUR_DSN;UID=YOUR_USER;PWD=YOUR_PASSWORD"+*

    Remember, the user YOUR_USER need to have the XLA privilege:

    *+(In ttisql, as the instance administrator)+*

    *+GRANT XLA to YOUR_USER;+*

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points