You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gabor Bartha <ga...@mailbox.hu> on 2002/09/27 12:36:08 UTC

esql:parameter ?

Hi all,

I want to use esql, but I've got problems with <esql:parameter>. It 
seems the parameter haven't been replaced by its real value.
Here is my xsp, with a java function:

<xsp:logic>
private String createTable() throws SQLException, org.xml.sax.SAXException
{
    String tableName = "tmp123456";

    //Create table

    <esql:connection>
    <esql:driver transactions="no">oracle.jdbc.OracleDriver</esql:driver>
    <esql:dburl>jdbc:oracle:thin:@localhost:1521:OEMREP</esql:dburl>
    <esql:username>SCOTT</esql:username>
    <esql:password>TIGER</esql:password>
    <esql:execute-query>
                <esql:query>create table 
<esql:parameter><xsp:expr>tableName</xsp:expr></esql:parameter> (id int 
not null primary key)</esql:query>
            <!--esql:error-results>
                    <error><esql:get-message/></error>
                </esql:error-results-->
        </esql:execute-query>
    </esql:connection>

  return tableName;
}
</xsp:logic>
...
...



When I call the function from the xsp body I've got the following sql 
exception:

Error executing statement: create table ? (cd_id int not null primary 
key): java.sql.SQLException:
 ORA-00903: invalid table name

I tried to use the direction="in" with the same result. Any Idea?

Regards,
Gabor



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: esql:parameter ?

Posted by Gabor Bartha <ga...@mailbox.hu>.
Ok it is working now,

thanks Ugo

yuryx wrote:

> try
> <esql:query><xsp:expr>"create table "+ 
> tableName</xsp:expr></esql:parameter>
>
> Ugo Cei wrote:
>
>> Gabor Bartha wrote:
>>
>>> Hi all,
>>>
>>> I want to use esql, but I've got problems with <esql:parameter>. It
>>> seems the parameter haven't been replaced by its real value.
>>
>>
>>
>> You cannot have DDL statements with parametrized object names. At
>> least, not in Oracle. Use string concatenation, if you must.
>>
>>     Ugo
>>
>>> Here is my xsp, with a java function:
>>>
>>> <xsp:logic>
>>> private String createTable() throws SQLException,
>>> org.xml.sax.SAXException
>>> {
>>>    String tableName = "tmp123456";
>>>
>>>    //Create table
>>>
>>>    <esql:connection>
>>>    <esql:driver 
>>> transactions="no">oracle.jdbc.OracleDriver</esql:driver>
>>>    <esql:dburl>jdbc:oracle:thin:@localhost:1521:OEMREP</esql:dburl>
>>>    <esql:username>SCOTT</esql:username>
>>>    <esql:password>TIGER</esql:password>
>>>    <esql:execute-query>
>>>                <esql:query>create table
>>> <esql:parameter><xsp:expr>tableName</xsp:expr></esql:parameter> (id
>>> int not null primary key)</esql:query>
>>>            <!--esql:error-results>
>>>                    <error><esql:get-message/></error>
>>>                </esql:error-results-->
>>>        </esql:execute-query>
>>>    </esql:connection>
>>>
>>>  return tableName;
>>> }
>>> </xsp:logic>
>>> ...
>>> ...
>>>
>>>
>>>
>>> When I call the function from the xsp body I've got the following sql
>>> exception:
>>>
>>> Error executing statement: create table ? (cd_id int not null primary
>>> key): java.sql.SQLException:
>>> ORA-00903: invalid table name
>>>
>>> I tried to use the direction="in" with the same result. Any Idea?
>>>
>>> Regards,
>>> Gabor
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> Please check that your question  has not already been answered in the
>>> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>>>
>>> To unsubscribe, e-mail:     <co...@xml.apache.org>
>>> For additional commands, e-mail:   <co...@xml.apache.org>
>>
>>
>>
>>
>
>
> --
>
> Best regards,
> Yury.
> --
> Yury Mikhienko.
> IT engineer, ZAO "Mobicom-Kavkaz"
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
> .
>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: esql:parameter ?

Posted by yuryx <yu...@mobicomk.donpac.ru>.
try
<esql:query><xsp:expr>"create table "+ tableName</xsp:expr></esql:parameter>

Ugo Cei wrote:

> Gabor Bartha wrote:
>
>> Hi all,
>>
>> I want to use esql, but I've got problems with <esql:parameter>. It 
>> seems the parameter haven't been replaced by its real value.
>
>
> You cannot have DDL statements with parametrized object names. At 
> least, not in Oracle. Use string concatenation, if you must.
>
>     Ugo
>
>> Here is my xsp, with a java function:
>>
>> <xsp:logic>
>> private String createTable() throws SQLException, 
>> org.xml.sax.SAXException
>> {
>>    String tableName = "tmp123456";
>>
>>    //Create table
>>
>>    <esql:connection>
>>    <esql:driver transactions="no">oracle.jdbc.OracleDriver</esql:driver>
>>    <esql:dburl>jdbc:oracle:thin:@localhost:1521:OEMREP</esql:dburl>
>>    <esql:username>SCOTT</esql:username>
>>    <esql:password>TIGER</esql:password>
>>    <esql:execute-query>
>>                <esql:query>create table 
>> <esql:parameter><xsp:expr>tableName</xsp:expr></esql:parameter> (id 
>> int not null primary key)</esql:query>
>>            <!--esql:error-results>
>>                    <error><esql:get-message/></error>
>>                </esql:error-results-->
>>        </esql:execute-query>
>>    </esql:connection>
>>
>>  return tableName;
>> }
>> </xsp:logic>
>> ...
>> ...
>>
>>
>>
>> When I call the function from the xsp body I've got the following sql 
>> exception:
>>
>> Error executing statement: create table ? (cd_id int not null primary 
>> key): java.sql.SQLException:
>> ORA-00903: invalid table name
>>
>> I tried to use the direction="in" with the same result. Any Idea?
>>
>> Regards,
>> Gabor
>>
>>
>>
>> ---------------------------------------------------------------------
>> Please check that your question  has not already been answered in the
>> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>>
>> To unsubscribe, e-mail:     <co...@xml.apache.org>
>> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


-- 

Best regards,
Yury.
--
Yury Mikhienko.
IT engineer, ZAO "Mobicom-Kavkaz"




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: esql:parameter ?

Posted by Ugo Cei <u....@cbim.it>.
Gabor Bartha wrote:
> Hi all,
> 
> I want to use esql, but I've got problems with <esql:parameter>. It 
> seems the parameter haven't been replaced by its real value.

You cannot have DDL statements with parametrized object names. At least, 
not in Oracle. Use string concatenation, if you must.

	Ugo

> Here is my xsp, with a java function:
> 
> <xsp:logic>
> private String createTable() throws SQLException, org.xml.sax.SAXException
> {
>    String tableName = "tmp123456";
> 
>    //Create table
> 
>    <esql:connection>
>    <esql:driver transactions="no">oracle.jdbc.OracleDriver</esql:driver>
>    <esql:dburl>jdbc:oracle:thin:@localhost:1521:OEMREP</esql:dburl>
>    <esql:username>SCOTT</esql:username>
>    <esql:password>TIGER</esql:password>
>    <esql:execute-query>
>                <esql:query>create table 
> <esql:parameter><xsp:expr>tableName</xsp:expr></esql:parameter> (id int 
> not null primary key)</esql:query>
>            <!--esql:error-results>
>                    <error><esql:get-message/></error>
>                </esql:error-results-->
>        </esql:execute-query>
>    </esql:connection>
> 
>  return tableName;
> }
> </xsp:logic>
> ...
> ...
> 
> 
> 
> When I call the function from the xsp body I've got the following sql 
> exception:
> 
> Error executing statement: create table ? (cd_id int not null primary 
> key): java.sql.SQLException:
> ORA-00903: invalid table name
> 
> I tried to use the direction="in" with the same result. Any Idea?
> 
> Regards,
> Gabor
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>


-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>