Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

how oddjob execute sql with mysql driver

General
henyo
2011-11-22
2013-05-28
  • henyo
    henyo
    2011-11-22

    hello everyone here,I meet some problem and I realy need your help.
    1. how to use oddjob`s function that execute sql statement.my db is mysql,how could I get the connect with
    "
    connection driver="com.mysql.jdbc.Driver" password="root" url="jdbc:mysql://127.0.0.1:3306/test" username="root"
    "
    it do not work.

    2. and a nother question is I didn`t found web information for oddjob. If I want use oddjob with my chrome ,what should I learn.

     
  • Rob Gordon
    Rob Gordon
    2011-11-22

    Hi

    - Can you post the XML configuration you are trying for the SQL job please, and the error you are getting.

    - Oddjob comes with a .war that can be deployed in a servlet engine like tomcat. It's not very pretty and is currently in the process of being re-written.

    Rob.

     
  • henyo
    henyo
    2011-11-23

    this is my sql.xml:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <oddjob>
    <job>
    <sequential name="sql">
    <jobs>
    <sql name="select">
    <connection>
    <connection driver="com.mysql.jdbc.Driver" password="root" url="jdbc:mysql://127.0.0.1:3306/test" username="root"/>
    <classLoader>
    <url-class-loader>
    <files>
    <file file="E:\source\oddjob\maTest\mysql-connector-java-5.0.8-bin.jar"/>
    </files>
    </url-class-loader>
    </classLoader>
    </connection>
    <input>
    <buffer><![CDATA]></buffer>
    </input>
    </sql>
    </jobs>
    </sequential>
    </job>
    </oddjob>
    ===============================================================================================
    and the error is :

    file:/E:/source/oddjob/maTest/sql.xml:9, 20 No definition for
    at org.oddjob.arooa.xml.XMLConfiguration.parse(XMLConfiguration.java:267)
    at org.oddjob.arooa.standard.StandardArooaParser.parse(StandardArooaParser.java:117)
    at org.oddjob.Oddjob.doLoad(Oddjob.java:614)
    at org.oddjob.Oddjob.access$300(Oddjob.java:223)
    at org.oddjob.Oddjob$1.run(Oddjob.java:662)
    at org.oddjob.state.StateHandler.doWhen(StateHandler.java:221)
    at org.oddjob.state.StateHandler.waitToWhen(StateHandler.java:202)
    at org.oddjob.Oddjob.load(Oddjob.java:651)
    at org.oddjob.monitor.action.LoadAction$1.run(LoadAction.java:74)
    at org.oddjob.util.SimpleThreadManager$1.run(SimpleThreadManager.java:45)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: org.oddjob.arooa.ArooaException: No definition for
    at org.oddjob.arooa.standard.ValueConfigurationCreator.onElement(ValueConfigurationCreator.java:28)
    at org.oddjob.arooa.standard.ValueConfigurationCreator.onElement(ValueConfigurationCreator.java:11)
    at org.oddjob.arooa.reflect.PropertyIdentifier$1.onElement(PropertyIdentifier.java:85)
    at org.oddjob.arooa.standard.SimplePropertyRuntime$1.onStartElement(SimplePropertyRuntime.java:36)
    at org.oddjob.arooa.xml.SAXHandler.startElement(SAXHandler.java:156)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.oddjob.arooa.xml.XMLConfiguration.parse(XMLConfiguration.java:252)
    … 15 more
    ===============================================================================================
    what`s the <classloader> mean?

     
  • henyo
    henyo
    2011-11-23

    I have run the oddjob.war with my tomcat .but what I want know is how could I add my job then package it to .war so that I can watch my job with browser.

     
  • Rob Gordon
    Rob Gordon
    2011-11-23

    classLoader is a property of tye connection type. What you want is:

    <oddjob>
        <job>
            <sequential name="sql">
                <jobs>
                    <sql name="select">
                        <connection>
                            <connection driver="com.mysql.jdbc.Driver"
                                password="root" url="jdbc:mysql://127.0.0.1:3306/test"
                                username="root">
                                <classLoader>
                                    <url-class-loader>
                                        <files>
                                            <file
                                                file="E:\source\oddjob\maTest\mysql-connector-java-5.0.8-bin.jar"/>
                                        </files>
                                    </url-class-loader>
                                </classLoader>
                            </connection>
                        </connection>
                        <input>
                            <buffer><![CDATA]></buffer>
                        </input>
                    </sql>
                </jobs>
            </sequential>
        </job>
    </oddjob>

    A very small but important difference!

    Rob.

     
  • Rob Gordon
    Rob Gordon
    2011-11-23

    With regard to the webapp you can either add the job classes or jar to the webapp WEB-INF/classes or WEB-INF/lib directory and edit the WEB-INF/oddjob.xml to run them or you can use the client already configured in the webapp to connect to a separate oddjob server process.

    Rob.

     
  • henyo
    henyo
    2011-11-23

    with your xml , I get some error,what`s this?

    file:/E:/source/oddjob/maTest/sql.xml:9, 20 No definition for
    at org.oddjob.arooa.xml.XMLConfiguration.parse(XMLConfiguration.java:267)
    at org.oddjob.arooa.standard.StandardArooaParser.parse(StandardArooaParser.java:117)
    at org.oddjob.Oddjob.doLoad(Oddjob.java:614)
    at org.oddjob.Oddjob.access$300(Oddjob.java:223)
    at org.oddjob.Oddjob$1.run(Oddjob.java:662)
    at org.oddjob.state.StateHandler.doWhen(StateHandler.java:221)
    at org.oddjob.state.StateHandler.waitToWhen(StateHandler.java:202)
    at org.oddjob.Oddjob.load(Oddjob.java:651)
    at org.oddjob.monitor.OddjobExplorer.open(OddjobExplorer.java:1193)
    at org.oddjob.monitor.OddjobExplorer.access$1700(OddjobExplorer.java:92)
    at org.oddjob.monitor.OddjobExplorer$OpenAction.actionPerformed(OddjobExplorer.java:1038)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
    at java.awt.Component.processMouseEvent(Component.java:6263)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: org.oddjob.arooa.ArooaException: No definition for
    at org.oddjob.arooa.standard.ValueConfigurationCreator.onElement(ValueConfigurationCreator.java:28)
    at org.oddjob.arooa.standard.ValueConfigurationCreator.onElement(ValueConfigurationCreator.java:11)
    at org.oddjob.arooa.reflect.PropertyIdentifier$1.onElement(PropertyIdentifier.java:85)
    at org.oddjob.arooa.standard.SimplePropertyRuntime$1.onStartElement(SimplePropertyRuntime.java:36)
    at org.oddjob.arooa.xml.SAXHandler.startElement(SAXHandler.java:156)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.oddjob.arooa.xml.XMLConfiguration.parse(XMLConfiguration.java:252)

     
  • henyo
    henyo
    2011-11-23

    oh…I have found my error,~_~  miss an </connection>…

     
  • henyo
    henyo
    2011-11-23

    this is the finall xml file, it run well on my computer (because the document is not detaile,I spend two days on learn the odd`s xml …):

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <oddjob>
    <job>
    <sequential name="sql">
    <jobs>
    <sql id="query">
    <connection>
    <connection driver="com.mysql.jdbc.Driver"
    password="root" url="jdbc:mysql://127.0.0.1:3306/test"
    username="root">
    <classLoader>
    <url-class-loader>
    <files>
    <file
    file="E:\source\oddjob\maTest\mysql-connector-java-5.0.8-bin.jar"/>
    </files>
    </url-class-loader>
    </classLoader>
    </connection>
    </connection>
    <input>
    <buffer><![CDATA]></buffer>
    </input>
    <results>
    <sql-results-bean/>
    </results>

    </sql>
    <echo name="Result By Row Index">last_update is : ${query.results.rows.LAST_UPDATE}</echo>
    </jobs>
    </sequential>
    </job>
    </oddjob>
    ===============================================================================================
    thanks rob-gordon !