SQL Problems

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SQL Problems

TonyM-2
I'm struggling with how to get sql working on Tomcat.

Within tomcat's server.xml, I have inserted the following.

        <Context>
            <Resource name="jdbc/euarates" auth="Container" type=" javax.sql.DataSource"
                username="euarates" password="password" driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://localhost:3306/eua?autoReconnect=true" maxactive="30"
                validationQuery="call test()" maxIdle="20000" maxWait="120" maxActive="10"/>
        </Context>


I have placed the file mysql-connector-java-5.0.4-bin.jar within ~\Tomcat 5.5\common\lib

I then have the following code within view.xhtml



<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf=" http://www.w3.org/2002/xforms" xmlns:sql="http://orbeon.org/oxf/xml/sql">

  <body>


    <sql:config>
      <sampledata>
        <sql:connection>
          <sql:datasource>jdbc/euarates</sql:datasource>
          <sql:execute>
            <sql:query> select * from eua.test </sql:query>
          </sql:execute>
        </sql:connection>
      </sampledata>
    </sql:config>

    <xf:output value="sampledata"/>


  </body>

When viewing the page, all is see is

jdbc/euarates select * from eua.test

What I am trying to see of course is the contents of the table test within catalog eua within a mysql database.

Thanks
Tony




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: SQL Problems

Ryan Puddephatt
Tony,
    You will need to build and XPL and use the SQL Processor (http://www.orbeon.com/ops/doc/processors-sql)
 
Ryan

Ryan Puddephatt
Software Engineer
 

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> www.teleflex.com

 


From: Tony Mobbs [mailto:[hidden email]]
Sent: 24 December 2006 09:50
To: [hidden email]
Subject: [ops-users] SQL Problems

I'm struggling with how to get sql working on Tomcat.

Within tomcat's server.xml, I have inserted the following.

        <Context>
            <Resource name="jdbc/euarates" auth="Container" type=" javax.sql.DataSource"
                username="euarates" password="password" driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://localhost:3306/eua?autoReconnect=true" maxactive="30"
                validationQuery="call test()" maxIdle="20000" maxWait="120" maxActive="10"/>
        </Context>


I have placed the file mysql-connector-java-5.0.4-bin.jar within ~\Tomcat 5.5\common\lib

I then have the following code within view.xhtml



<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf=" http://www.w3.org/2002/xforms" xmlns:sql="http://orbeon.org/oxf/xml/sql">

  <body>


    <sql:config>
      <sampledata>
        <sql:connection>
          <sql:datasource>jdbc/euarates</sql:datasource>
          <sql:execute>
            <sql:query> select * from eua.test </sql:query>
          </sql:execute>
        </sql:connection>
      </sampledata>
    </sql:config>

    <xf:output value="sampledata"/>


  </body>

When viewing the page, all is see is

jdbc/euarates select * from eua.test

What I am trying to see of course is the contents of the table test within catalog eua within a mysql database.

Thanks
Tony




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: SQL Problems

TonyM-2
Ryan

Thanks for info about XPL - I will read that soon.

To avoid any XPL issues, I tried the following database update:

insert into eua.test(test) values (2);

This command works perfectly when I test against the database directly and performs the update as expected.

Why then does the following not work?

    <sql:config>
      <sampledata>
        <sql:connection>
          <sql:datasource>jdbc/euarates</sql:datasource>
          <sql:execute>
            <sql:query> insert into eua.test(test) values (2) </sql:query>
          </sql:execute>
        </sql:connection>
      </sampledata>
    </sql:config>

What I do get is the following output to the screen  - which I do not want.

jdbc/euarates insert into eua.test(test) values (2)

Regards
Tony



On 24/12/06, Ryan Puddephatt <[hidden email]> wrote:
Tony,
    You will need to build and XPL and use the SQL Processor (<a href="http://www.orbeon.com/ops/doc/processors-sql" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.orbeon.com/ops/doc/processors-sql)
 
Ryan

Ryan Puddephatt
Software Engineer
 

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> <a href="http://www.teleflex.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">www.teleflex.com

 


From: Tony Mobbs [mailto:[hidden email]]
Sent: 24 December 2006 09:50
To: [hidden email]
Subject: [ops-users] SQL Problems

I'm struggling with how to get sql working on Tomcat.

Within tomcat's server.xml, I have inserted the following.

        <Context>
            <Resource name="jdbc/euarates" auth="Container" type=" javax.sql.DataSource"
                username="euarates" password="password" driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://localhost:3306/eua?autoReconnect=true" maxactive="30"
                validationQuery="call test()" maxIdle="20000" maxWait="120" maxActive="10"/>
        </Context>


I have placed the file mysql-connector-java-5.0.4-bin.jar within ~\Tomcat 5.5\common\lib

I then have the following code within view.xhtml



<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/1999/xhtml" xmlns:xf="<a href="http://www.w3.org/2002/xforms" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.w3.org/2002/xforms" xmlns:sql="<a href="http://orbeon.org/oxf/xml/sql" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://orbeon.org/oxf/xml/sql">

  <body>


    <sql:config>
      <sampledata>
        <sql:connection>
          <sql:datasource>jdbc/euarates</sql:datasource>
          <sql:execute>
            <sql:query> select * from eua.test </sql:query>
          </sql:execute>
        </sql:connection>
      </sampledata>
    </sql:config>

    <xf:output value="sampledata"/>


  </body>

When viewing the page, all is see is

jdbc/euarates select * from eua.test

What I am trying to see of course is the contents of the table test within catalog eua within a mysql database.

Thanks
Tony






--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: SQL Problems

Alessandro  Vernet
Administrator
Hi Tony,

Ryan's point is that what you see is normal. Adding <sql:config> to
your XHTML+XForms page won't get you the result you might expect. To
run the SQL processor, you need to write some XPL.

To illustrate this, I just checked in an example that uses the XForms
and the SQL processor. This is an updated version of the "Address
Book" example we used to have.

I recommend you get a new nightly build
(http://forge.objectweb.org/nightlybuilds/ops/ops/), and run the SQL
Address Book example. You will find it in the list of examples at the
left of the page.

Then have a look at the source under resources/apps/sql-address-book.
Hopefully the code speaks for itself :). And if anything is not clear,
feel free to post your questions here.

Alex

On 12/24/06, Tony Mobbs <[hidden email]> wrote:

> Ryan
>
> Thanks for info about XPL - I will read that soon.
>
> To avoid any XPL issues, I tried the following database update:
>
> insert into eua.test(test) values (2);
>
> This command works perfectly when I test against the database directly and performs the update as expected.
>
> Why then does the following not work?
>
>     <sql:config>
>       <sampledata>
>         <sql:connection>
>           <sql:datasource>jdbc/euarates</sql:datasource>
>           <sql:execute>
>             <sql:query> insert into eua.test(test) values (2) </sql:query>
>           </sql:execute>
>         </sql:connection>
>       </sampledata>
>     </sql:config>
>
>  What I do get is the following output to the screen  - which I do not want.
>
> jdbc/euarates                                                   insert into eua.test(test) values (2)
>
> Regards
> Tony
>
>
>
>
>
> On 24/12/06, Ryan Puddephatt < [hidden email]> wrote:
> >
> >
> > Tony,
> >     You will need to build and XPL and use the SQL  Processor (http://www.orbeon.com/ops/doc/processors-sql)
> >
> > Ryan
> >
> >
> >
> >
> > Ryan  Puddephatt
> > Software  Engineer
> >
> >
> > Teleflex Group - IT  UK
> > 1 Michaelson  Square
> > Livingston
> > West  Lothian
> > Scotland
> > EH54  7DP
> >
> > e> [hidden email]
> > t>  +44(0)1506 407 110
> > f> +44(0)1506 407  108
> > w> www.teleflex.com
> >
> >
> >
> >
> >    ________________________________
   From: Tony Mobbs [mailto:[hidden email]]

> > Sent: 24 December 2006 09:50
> > To:    [hidden email]
> > Subject: [ops-users] SQL    Problems
> >
> >
> >
> > I'm struggling with how to get sql working on Tomcat.
> >
> > Within    tomcat's server.xml, I have inserted the    following.
> >
> >            <Context>
> >                <Resource name="jdbc/euarates" auth="Container" type="    javax.sql.DataSource"
> >                    username="euarates" password="password"    driverClassName="com.mysql.jdbc.Driver"
> >                    url="jdbc:mysql://localhost:3306/eua?autoReconnect=true" maxactive="30"
> >                    validationQuery="call test()" maxIdle="20000" maxWait="120"    maxActive="10"/>
> >            </Context>
> >
> >
> > I have placed the file    mysql-connector-java-5.0.4-bin.jar within ~\Tomcat 5.5\common\lib
> >
> > I    then have the following code within view.xhtml
> >
> >
> >
> > <html    xmlns="http://www.w3.org/1999/xhtml"    xmlns:xf="    http://www.w3.org/2002/xforms" xmlns:sql="http://orbeon.org/oxf/xml/sql">
> >
> >       <body>
> >
> >
> >        <sql:config>
> >       <sampledata>
> >            <sql:connection>
> >              <sql:datasource>jdbc/euarates</sql:datasource>
> >              <sql:execute>
> >                <sql:query> select * from eua.test    </sql:query>
> >              </sql:execute>
> >            </sql:connection>
> >          </sampledata>
> >        </sql:config>
> >
> >     <xf:output    value="sampledata"/>
> >
> >
> >   </body>
> >
> > When viewing    the page, all is see is
> >
> > jdbc/euarates select * from    eua.test
> >
> > What I am trying to see of course is the contents of the table    test within catalog eua within a mysql    database.
> >
> > Thanks
> > Tony
> >
> >
> >
> >
>
>
>


--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: SQL Problems

Erik Bruchez
Administrator
In reply to this post by TonyM-2
Tony,

> Thanks for info about XPL - I will read that soon.
>
> To avoid any XPL issues, I tried the following database update:
>
> insert into eua.test(test) values (2);
>
> This command works perfectly when I test against the database directly
> and performs the update as expected.
>
> Why then does the following not work?
>
>     <sql:config>
>       <sampledata>
>         <sql:connection>
>           <sql:datasource>jdbc/euarates</sql:datasource>
>           <sql:execute>
>             <sql:query> insert into eua.test(test) values (2) </sql:query>
>           </sql:execute>
>         </sql:connection>
>       </sampledata>
>     </sql:config>
>
> What I do get is the following output to the screen  - which I do not want.
>
> jdbc/euarates insert into eua.test(test) values (2)
Try this instead:

<sql:datasource>euarates</sql:datasource>

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws