You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Sonu Vijay <so...@yahoo.com> on 2003/12/04 23:13:59 UTC

Printing SQL

Hi,
Can we print the actual SQL that is made out of the
Criteria.
My selects work but inserts don't, I need to see the
SQL as the following stack trace indicated syntax
errors.

Thanks

Vijay

-----------------------
java.sql.SQLException: [SQL0104] Token ) was not
valid. Valid tokens: DAY PATH YEAR LABEL MONTH OPTION
RESULT CONNECTION TRANSACTION.
	at
com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
	at
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1088)
	at
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
	at
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
	at
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1371)
	at
org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:271)
	at
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:372)
	at
com.workingdogs.village.Record.saveWithInsert(Unknown
Source)
	at com.workingdogs.village.Record.save(Unknown
Source)
	at com.workingdogs.village.Record.save(Unknown
Source)
	at
org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:891)
	at
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:725)
	at
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:218)
	at
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:565)
	at com.suz.torque.pitchers.BaseTeam.save(BaseTeam.java:1081)

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
Thanks for u reply Jeff.

I've tried printing the Criteria at that point and
others too but doesn't give me the Insert SQL. Always
the Select statements.

Why would anybody want to see the Select or only the
Select statement when he has problems with inserts.

Is there any specific reason why printing of Inserts
in blocked.




--- Jeff Rasmussen <jr...@lnxi.com> wrote:
> In the Base"TABLE"Peer File created by torque You
> should have a method
> doInsert(Object).
> 
> This builds a criteria from the Object.
> Then calls doInsert(Criteria).
> Ex.
> 
>     /** Method to do inserts */
>     public static void doInsert(Node obj) throws
> TorqueException
>     {
>                 doInsert(buildCriteria(obj));
>                 obj.setNew(false);
>                 obj.setModified(false);
>     }
> 
> 
>      /**
>      * Method to do inserts
>      */
>     public static ObjectKey doInsert(Criteria
> criteria)
>         throws TorqueException{
>         return BaseNodePeer
>             .doInsert(criteria, (Connection) null);
>     }
> 
> 
> You should be able to add a println on the second
> method as follows:
> 
> /**
>      * Method to do inserts
>      */
>     public static ObjectKey doInsert(Criteria
> criteria) throws
> TorqueException{
>         System.out.println(criteria.toString());
>         return BaseNodePeer.doInsert(criteria,
> (Connection) null);
>     }
> 
> I have not tried this so forgive me if it doesn't
> work.
> 
> 
> Jeff Rasmussen
> 
> 
> On Thu, 2003-12-04 at 15:52, Sonu Vijay wrote:
> > Yeah, I am having problems with Inserts. And it
> the
> > damn DB2400. Everything works perfectly when I
> tried
> > on MySQL. But there also I Criteria prints only
> > Selects, no Inserts get printed.
> > 
> > I don't understand when a Select is done
> > Criteria.toString() prints a SELECT SQL and when
> an
> > Insert is being done then also its give a SELECT
> only.
> > 
> > What's going on here.
> > 
> > 
> > --- Scott Eade <se...@backstagetech.com.au> wrote:
> > > This will log selects, but not inserts and
> updates.
> > > 
> > > Scott
> > > 
> > > -- 
> > > Scott Eade
> > > Backstage Technologies Pty. Ltd.
> > > http://www.backstagetech.com.au
> > > 
> > > 
> > > Tulsi Das wrote:
> > > 
> > > >or, better yet, you can setup Log4J to DEBUG
> level,
> > > and all queries get
> > > >printed out to wherever you've configured it.
> > > >
> > > >tulsi
> > > >
> > > >
> > > > --- Jeff Rasmussen <jr...@lnxi.com>
> escribi:
> > > 
> > > >  
> > > >
> > > >>This should work. I've been using it.
> > > >>
> > > >>Criteria crit = new Criteria();
> > > >>....
> > > >>....
> > > >>....
> > > >>System.out.println(crit.toString());
> > > >>
> > > >>Jeff Rasmussen
> > > >>
> > > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > > >>    
> > > >>
> > > >>>Hi,
> > > >>>Can we print the actual SQL that is made out
> of
> > > the
> > > >>>Criteria.
> > > >>>My selects work but inserts don't, I need to
> see
> > > the
> > > >>>SQL as the following stack trace indicated
> syntax
> > > >>>errors.
> > > >>>
> > > >>>Thanks
> > > >>>
> > > >>>Vijay
> > > >>>      
> > > >>>
> > > 
> > > 
> > > 
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail:
> > > torque-user-help@db.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> torque-user-help@db.apache.org
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Jeff Rasmussen <jr...@lnxi.com>.
In the Base"TABLE"Peer File created by torque You should have a method
doInsert(Object).

This builds a criteria from the Object.
Then calls doInsert(Criteria).
Ex.

    /** Method to do inserts */
    public static void doInsert(Node obj) throws TorqueException
    {
                doInsert(buildCriteria(obj));
                obj.setNew(false);
                obj.setModified(false);
    }


     /**
     * Method to do inserts
     */
    public static ObjectKey doInsert(Criteria criteria)
        throws TorqueException{
        return BaseNodePeer
            .doInsert(criteria, (Connection) null);
    }


You should be able to add a println on the second method as follows:

/**
     * Method to do inserts
     */
    public static ObjectKey doInsert(Criteria criteria) throws
TorqueException{
        System.out.println(criteria.toString());
        return BaseNodePeer.doInsert(criteria, (Connection) null);
    }

I have not tried this so forgive me if it doesn't work.


Jeff Rasmussen


On Thu, 2003-12-04 at 15:52, Sonu Vijay wrote:
> Yeah, I am having problems with Inserts. And it the
> damn DB2400. Everything works perfectly when I tried
> on MySQL. But there also I Criteria prints only
> Selects, no Inserts get printed.
> 
> I don't understand when a Select is done
> Criteria.toString() prints a SELECT SQL and when an
> Insert is being done then also its give a SELECT only.
> 
> What's going on here.
> 
> 
> --- Scott Eade <se...@backstagetech.com.au> wrote:
> > This will log selects, but not inserts and updates.
> > 
> > Scott
> > 
> > -- 
> > Scott Eade
> > Backstage Technologies Pty. Ltd.
> > http://www.backstagetech.com.au
> > 
> > 
> > Tulsi Das wrote:
> > 
> > >or, better yet, you can setup Log4J to DEBUG level,
> > and all queries get
> > >printed out to wherever you've configured it.
> > >
> > >tulsi
> > >
> > >
> > > --- Jeff Rasmussen <jr...@lnxi.com> escribi:
> > 
> > >  
> > >
> > >>This should work. I've been using it.
> > >>
> > >>Criteria crit = new Criteria();
> > >>....
> > >>....
> > >>....
> > >>System.out.println(crit.toString());
> > >>
> > >>Jeff Rasmussen
> > >>
> > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > >>    
> > >>
> > >>>Hi,
> > >>>Can we print the actual SQL that is made out of
> > the
> > >>>Criteria.
> > >>>My selects work but inserts don't, I need to see
> > the
> > >>>SQL as the following stack trace indicated syntax
> > >>>errors.
> > >>>
> > >>>Thanks
> > >>>
> > >>>Vijay
> > >>>      
> > >>>
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> > torque-user-help@db.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
The default value of idBroker for a Table in the
schema is null (According to
http://db.apache.org/torque/generator/schema-reference.html).

Is that same is idBroker="none" ?

If not what's the differene between null and none
here.




--- Ramesh Sabeti <rs...@reazon.com> wrote:
> Criteria doesn't know about the operations such as
> INSERT or SELECT.
> When you print the criteria, you're only printing
> the WHERE clause.
> Criteria.toString() will tell you how it would look
> like if you were
> doing a SELECT statement.
> 
> Debug your Java classes created by torque.  We found
> out our Inserts
> didn't work because how id's were generated.  That
> usually gets you
> moving from one database to another.
> 
> Ramesh.
> 
> > -----Original Message-----
> > From: Sonu Vijay [mailto:sonupv@yahoo.com]
> > Sent: Thursday, December 04, 2003 2:53 PM
> > To: Apache Torque Users List
> > Subject: Re: Printing SQL
> > 
> > Yeah, I am having problems with Inserts. And it
> the
> > damn DB2400. Everything works perfectly when I
> tried
> > on MySQL. But there also I Criteria prints only
> > Selects, no Inserts get printed.
> > 
> > I don't understand when a Select is done
> > Criteria.toString() prints a SELECT SQL and when
> an
> > Insert is being done then also its give a SELECT
> only.
> > 
> > What's going on here.
> > 
> > 
> > --- Scott Eade <se...@backstagetech.com.au> wrote:
> > > This will log selects, but not inserts and
> updates.
> > >
> > > Scott
> > >
> > > --
> > > Scott Eade
> > > Backstage Technologies Pty. Ltd.
> > > http://www.backstagetech.com.au
> > >
> > >
> > > Tulsi Das wrote:
> > >
> > > >or, better yet, you can setup Log4J to DEBUG
> level,
> > > and all queries get
> > > >printed out to wherever you've configured it.
> > > >
> > > >tulsi
> > > >
> > > >
> > > > --- Jeff Rasmussen <jr...@lnxi.com>
> escribi�:
> > >
> > > >
> > > >
> > > >>This should work. I've been using it.
> > > >>
> > > >>Criteria crit = new Criteria();
> > > >>....
> > > >>....
> > > >>....
> > > >>System.out.println(crit.toString());
> > > >>
> > > >>Jeff Rasmussen
> > > >>
> > > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > > >>
> > > >>
> > > >>>Hi,
> > > >>>Can we print the actual SQL that is made out
> of
> > > the
> > > >>>Criteria.
> > > >>>My selects work but inserts don't, I need to
> see
> > > the
> > > >>>SQL as the following stack trace indicated
> syntax
> > > >>>errors.
> > > >>>
> > > >>>Thanks
> > > >>>
> > > >>>Vijay
> > > >>>
> > > >>>
> > >
> > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail:
> > > torque-user-help@db.apache.org
> > >
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> torque-user-help@db.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Printing SQL

Posted by Jeff Rasmussen <jr...@lnxi.com>.
Well I tried editing the code for a delete and successfully recieved the
following on the crit.toString(). (My Table is called USER)
I added : 

System.out.println("Criteria Delete == "+criteria.toString());

in the doDelete(Criteria) method of my BaseUserPeer Class.

Output:
Criteria Delete == Criteria:: USER.USER_ID<=>USER.USER_ID=26:  


I don't see why you couldn't at least get a statement like this from the
doUpdate(Criteria) method.

Also, it looks like all updates take place in BasePeer.java which is
extended by all of the generated Base"TABLE"Peer classes. This is called
in doInsert(Criteria, Connection) of your BasePeer.

I will try to get some output from doInsert().


Jeff Rasmussen


On Thu, 2003-12-04 at 16:41, Sonu Vijay wrote:
> Ok guys where can I get the source for
> com.workingdogs.village.Record
> 
> Thanks
> 
> --- Sonu Vijay <so...@yahoo.com> wrote:
> > Well,
> > You may be right, but this DB2400 is a damn picky
> > monster. 
> > I have just added some debugging statements to
> > BasePeer.
> > There would be some point where an Insert statement
> > is
> > generated. Anyone knows where ??
> > 
> > I have all the code in my IDE now and now that I
> > have
> > started on this path would like to see the Insert
> > statement if I can before starting to look into
> > other
> > places.
> > 
> > Thanks
> > 
> > 
> > 
> > --- Ramesh Sabeti <rs...@reazon.com> wrote:
> > > Criteria doesn't know about the operations such as
> > > INSERT or SELECT.
> > > When you print the criteria, you're only printing
> > > the WHERE clause.
> > > Criteria.toString() will tell you how it would
> > look
> > > like if you were
> > > doing a SELECT statement.
> > > 
> > > Debug your Java classes created by torque.  We
> > found
> > > out our Inserts
> > > didn't work because how id's were generated.  That
> > > usually gets you
> > > moving from one database to another.
> > > 
> > > Ramesh.
> > > 
> > > > -----Original Message-----
> > > > From: Sonu Vijay [mailto:sonupv@yahoo.com]
> > > > Sent: Thursday, December 04, 2003 2:53 PM
> > > > To: Apache Torque Users List
> > > > Subject: Re: Printing SQL
> > > > 
> > > > Yeah, I am having problems with Inserts. And it
> > > the
> > > > damn DB2400. Everything works perfectly when I
> > > tried
> > > > on MySQL. But there also I Criteria prints only
> > > > Selects, no Inserts get printed.
> > > > 
> > > > I don't understand when a Select is done
> > > > Criteria.toString() prints a SELECT SQL and when
> > > an
> > > > Insert is being done then also its give a SELECT
> > > only.
> > > > 
> > > > What's going on here.
> > > > 
> > > > 
> > > > --- Scott Eade <se...@backstagetech.com.au>
> > wrote:
> > > > > This will log selects, but not inserts and
> > > updates.
> > > > >
> > > > > Scott
> > > > >
> > > > > --
> > > > > Scott Eade
> > > > > Backstage Technologies Pty. Ltd.
> > > > > http://www.backstagetech.com.au
> > > > >
> > > > >
> > > > > Tulsi Das wrote:
> > > > >
> > > > > >or, better yet, you can setup Log4J to DEBUG
> > > level,
> > > > > and all queries get
> > > > > >printed out to wherever you've configured it.
> > > > > >
> > > > > >tulsi
> > > > > >
> > > > > >
> > > > > > --- Jeff Rasmussen <jr...@lnxi.com>
> > > escribi:
> > > > >
> > > > > >
> > > > > >
> > > > > >>This should work. I've been using it.
> > > > > >>
> > > > > >>Criteria crit = new Criteria();
> > > > > >>....
> > > > > >>....
> > > > > >>....
> > > > > >>System.out.println(crit.toString());
> > > > > >>
> > > > > >>Jeff Rasmussen
> > > > > >>
> > > > > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay
> > wrote:
> > > > > >>
> > > > > >>
> > > > > >>>Hi,
> > > > > >>>Can we print the actual SQL that is made
> > out
> > > of
> > > > > the
> > > > > >>>Criteria.
> > > > > >>>My selects work but inserts don't, I need
> > to
> > > see
> > > > > the
> > > > > >>>SQL as the following stack trace indicated
> > > syntax
> > > > > >>>errors.
> > > > > >>>
> > > > > >>>Thanks
> > > > > >>>
> > > > > >>>Vijay
> > > > > >>>
> > > > > >>>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > > torque-user-unsubscribe@db.apache.org
> > > > > For additional commands, e-mail:
> > > > > torque-user-help@db.apache.org
> > > > >
> > > > 
> > > > 
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Free Pop-Up Blocker - Get it now
> > > > http://companion.yahoo.com/
> > > > 
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > torque-user-unsubscribe@db.apache.org
> > > > For additional commands, e-mail:
> > > torque-user-help@db.apache.org
> > > 
> > > 
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail:
> > > torque-user-help@db.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> > torque-user-help@db.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
Ok guys where can I get the source for
com.workingdogs.village.Record

Thanks

--- Sonu Vijay <so...@yahoo.com> wrote:
> Well,
> You may be right, but this DB2400 is a damn picky
> monster. 
> I have just added some debugging statements to
> BasePeer.
> There would be some point where an Insert statement
> is
> generated. Anyone knows where ??
> 
> I have all the code in my IDE now and now that I
> have
> started on this path would like to see the Insert
> statement if I can before starting to look into
> other
> places.
> 
> Thanks
> 
> 
> 
> --- Ramesh Sabeti <rs...@reazon.com> wrote:
> > Criteria doesn't know about the operations such as
> > INSERT or SELECT.
> > When you print the criteria, you're only printing
> > the WHERE clause.
> > Criteria.toString() will tell you how it would
> look
> > like if you were
> > doing a SELECT statement.
> > 
> > Debug your Java classes created by torque.  We
> found
> > out our Inserts
> > didn't work because how id's were generated.  That
> > usually gets you
> > moving from one database to another.
> > 
> > Ramesh.
> > 
> > > -----Original Message-----
> > > From: Sonu Vijay [mailto:sonupv@yahoo.com]
> > > Sent: Thursday, December 04, 2003 2:53 PM
> > > To: Apache Torque Users List
> > > Subject: Re: Printing SQL
> > > 
> > > Yeah, I am having problems with Inserts. And it
> > the
> > > damn DB2400. Everything works perfectly when I
> > tried
> > > on MySQL. But there also I Criteria prints only
> > > Selects, no Inserts get printed.
> > > 
> > > I don't understand when a Select is done
> > > Criteria.toString() prints a SELECT SQL and when
> > an
> > > Insert is being done then also its give a SELECT
> > only.
> > > 
> > > What's going on here.
> > > 
> > > 
> > > --- Scott Eade <se...@backstagetech.com.au>
> wrote:
> > > > This will log selects, but not inserts and
> > updates.
> > > >
> > > > Scott
> > > >
> > > > --
> > > > Scott Eade
> > > > Backstage Technologies Pty. Ltd.
> > > > http://www.backstagetech.com.au
> > > >
> > > >
> > > > Tulsi Das wrote:
> > > >
> > > > >or, better yet, you can setup Log4J to DEBUG
> > level,
> > > > and all queries get
> > > > >printed out to wherever you've configured it.
> > > > >
> > > > >tulsi
> > > > >
> > > > >
> > > > > --- Jeff Rasmussen <jr...@lnxi.com>
> > escribi�:
> > > >
> > > > >
> > > > >
> > > > >>This should work. I've been using it.
> > > > >>
> > > > >>Criteria crit = new Criteria();
> > > > >>....
> > > > >>....
> > > > >>....
> > > > >>System.out.println(crit.toString());
> > > > >>
> > > > >>Jeff Rasmussen
> > > > >>
> > > > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay
> wrote:
> > > > >>
> > > > >>
> > > > >>>Hi,
> > > > >>>Can we print the actual SQL that is made
> out
> > of
> > > > the
> > > > >>>Criteria.
> > > > >>>My selects work but inserts don't, I need
> to
> > see
> > > > the
> > > > >>>SQL as the following stack trace indicated
> > syntax
> > > > >>>errors.
> > > > >>>
> > > > >>>Thanks
> > > > >>>
> > > > >>>Vijay
> > > > >>>
> > > > >>>
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > torque-user-unsubscribe@db.apache.org
> > > > For additional commands, e-mail:
> > > > torque-user-help@db.apache.org
> > > >
> > > 
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Free Pop-Up Blocker - Get it now
> > > http://companion.yahoo.com/
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail:
> > torque-user-help@db.apache.org
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> > torque-user-help@db.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
Well,
You may be right, but this DB2400 is a damn picky
monster. 
I have just added some debugging statements to
BasePeer.
There would be some point where an Insert statement is
generated. Anyone knows where ??

I have all the code in my IDE now and now that I have
started on this path would like to see the Insert
statement if I can before starting to look into other
places.

Thanks



--- Ramesh Sabeti <rs...@reazon.com> wrote:
> Criteria doesn't know about the operations such as
> INSERT or SELECT.
> When you print the criteria, you're only printing
> the WHERE clause.
> Criteria.toString() will tell you how it would look
> like if you were
> doing a SELECT statement.
> 
> Debug your Java classes created by torque.  We found
> out our Inserts
> didn't work because how id's were generated.  That
> usually gets you
> moving from one database to another.
> 
> Ramesh.
> 
> > -----Original Message-----
> > From: Sonu Vijay [mailto:sonupv@yahoo.com]
> > Sent: Thursday, December 04, 2003 2:53 PM
> > To: Apache Torque Users List
> > Subject: Re: Printing SQL
> > 
> > Yeah, I am having problems with Inserts. And it
> the
> > damn DB2400. Everything works perfectly when I
> tried
> > on MySQL. But there also I Criteria prints only
> > Selects, no Inserts get printed.
> > 
> > I don't understand when a Select is done
> > Criteria.toString() prints a SELECT SQL and when
> an
> > Insert is being done then also its give a SELECT
> only.
> > 
> > What's going on here.
> > 
> > 
> > --- Scott Eade <se...@backstagetech.com.au> wrote:
> > > This will log selects, but not inserts and
> updates.
> > >
> > > Scott
> > >
> > > --
> > > Scott Eade
> > > Backstage Technologies Pty. Ltd.
> > > http://www.backstagetech.com.au
> > >
> > >
> > > Tulsi Das wrote:
> > >
> > > >or, better yet, you can setup Log4J to DEBUG
> level,
> > > and all queries get
> > > >printed out to wherever you've configured it.
> > > >
> > > >tulsi
> > > >
> > > >
> > > > --- Jeff Rasmussen <jr...@lnxi.com>
> escribi�:
> > >
> > > >
> > > >
> > > >>This should work. I've been using it.
> > > >>
> > > >>Criteria crit = new Criteria();
> > > >>....
> > > >>....
> > > >>....
> > > >>System.out.println(crit.toString());
> > > >>
> > > >>Jeff Rasmussen
> > > >>
> > > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > > >>
> > > >>
> > > >>>Hi,
> > > >>>Can we print the actual SQL that is made out
> of
> > > the
> > > >>>Criteria.
> > > >>>My selects work but inserts don't, I need to
> see
> > > the
> > > >>>SQL as the following stack trace indicated
> syntax
> > > >>>errors.
> > > >>>
> > > >>>Thanks
> > > >>>
> > > >>>Vijay
> > > >>>
> > > >>>
> > >
> > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail:
> > > torque-user-help@db.apache.org
> > >
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> torque-user-help@db.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Printing SQL

Posted by Ramesh Sabeti <rs...@reazon.com>.
Criteria doesn't know about the operations such as INSERT or SELECT.
When you print the criteria, you're only printing the WHERE clause.
Criteria.toString() will tell you how it would look like if you were
doing a SELECT statement.

Debug your Java classes created by torque.  We found out our Inserts
didn't work because how id's were generated.  That usually gets you
moving from one database to another.

Ramesh.

> -----Original Message-----
> From: Sonu Vijay [mailto:sonupv@yahoo.com]
> Sent: Thursday, December 04, 2003 2:53 PM
> To: Apache Torque Users List
> Subject: Re: Printing SQL
> 
> Yeah, I am having problems with Inserts. And it the
> damn DB2400. Everything works perfectly when I tried
> on MySQL. But there also I Criteria prints only
> Selects, no Inserts get printed.
> 
> I don't understand when a Select is done
> Criteria.toString() prints a SELECT SQL and when an
> Insert is being done then also its give a SELECT only.
> 
> What's going on here.
> 
> 
> --- Scott Eade <se...@backstagetech.com.au> wrote:
> > This will log selects, but not inserts and updates.
> >
> > Scott
> >
> > --
> > Scott Eade
> > Backstage Technologies Pty. Ltd.
> > http://www.backstagetech.com.au
> >
> >
> > Tulsi Das wrote:
> >
> > >or, better yet, you can setup Log4J to DEBUG level,
> > and all queries get
> > >printed out to wherever you've configured it.
> > >
> > >tulsi
> > >
> > >
> > > --- Jeff Rasmussen <jr...@lnxi.com> escribió:
> >
> > >
> > >
> > >>This should work. I've been using it.
> > >>
> > >>Criteria crit = new Criteria();
> > >>....
> > >>....
> > >>....
> > >>System.out.println(crit.toString());
> > >>
> > >>Jeff Rasmussen
> > >>
> > >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > >>
> > >>
> > >>>Hi,
> > >>>Can we print the actual SQL that is made out of
> > the
> > >>>Criteria.
> > >>>My selects work but inserts don't, I need to see
> > the
> > >>>SQL as the following stack trace indicated syntax
> > >>>errors.
> > >>>
> > >>>Thanks
> > >>>
> > >>>Vijay
> > >>>
> > >>>
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> > torque-user-help@db.apache.org
> >
> 
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
Yeah, I am having problems with Inserts. And it the
damn DB2400. Everything works perfectly when I tried
on MySQL. But there also I Criteria prints only
Selects, no Inserts get printed.

I don't understand when a Select is done
Criteria.toString() prints a SELECT SQL and when an
Insert is being done then also its give a SELECT only.

What's going on here.


--- Scott Eade <se...@backstagetech.com.au> wrote:
> This will log selects, but not inserts and updates.
> 
> Scott
> 
> -- 
> Scott Eade
> Backstage Technologies Pty. Ltd.
> http://www.backstagetech.com.au
> 
> 
> Tulsi Das wrote:
> 
> >or, better yet, you can setup Log4J to DEBUG level,
> and all queries get
> >printed out to wherever you've configured it.
> >
> >tulsi
> >
> >
> > --- Jeff Rasmussen <jr...@lnxi.com> escribi�:
> 
> >  
> >
> >>This should work. I've been using it.
> >>
> >>Criteria crit = new Criteria();
> >>....
> >>....
> >>....
> >>System.out.println(crit.toString());
> >>
> >>Jeff Rasmussen
> >>
> >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> >>    
> >>
> >>>Hi,
> >>>Can we print the actual SQL that is made out of
> the
> >>>Criteria.
> >>>My selects work but inserts don't, I need to see
> the
> >>>SQL as the following stack trace indicated syntax
> >>>errors.
> >>>
> >>>Thanks
> >>>
> >>>Vijay
> >>>      
> >>>
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Tulsi Das <qu...@yahoo.com>.
uuuooops, you're right!

tulsi

 --- Scott Eade <se...@backstagetech.com.au> escribió: 
> This will log selects, but not inserts and updates.
> 
> Scott
> 
> -- 
> Scott Eade
> Backstage Technologies Pty. Ltd.
> http://www.backstagetech.com.au
> 
> 
> Tulsi Das wrote:
> 
> >or, better yet, you can setup Log4J to DEBUG level, and all queries
> get
> >printed out to wherever you've configured it.
> >
> >tulsi
> >
> >
> > --- Jeff Rasmussen <jr...@lnxi.com> escribió: 
> >  
> >
> >>This should work. I've been using it.
> >>
> >>Criteria crit = new Criteria();
> >>....
> >>....
> >>....
> >>System.out.println(crit.toString());
> >>
> >>Jeff Rasmussen
> >>
> >>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> >>    
> >>
> >>>Hi,
> >>>Can we print the actual SQL that is made out of the
> >>>Criteria.
> >>>My selects work but inserts don't, I need to see the
> >>>SQL as the following stack trace indicated syntax
> >>>errors.
> >>>
> >>>Thanks
> >>>
> >>>Vijay
> >>>      
> >>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>  

------------
Los mejores usados y las más tentadoras 
ofertas de 0km están en Yahoo! Autos.
Comprá o vendé tu auto en
http://autos.yahoo.com.ar

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Scott Eade <se...@backstagetech.com.au>.
This will log selects, but not inserts and updates.

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


Tulsi Das wrote:

>or, better yet, you can setup Log4J to DEBUG level, and all queries get
>printed out to wherever you've configured it.
>
>tulsi
>
>
> --- Jeff Rasmussen <jr...@lnxi.com> escribió: 
>  
>
>>This should work. I've been using it.
>>
>>Criteria crit = new Criteria();
>>....
>>....
>>....
>>System.out.println(crit.toString());
>>
>>Jeff Rasmussen
>>
>>On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
>>    
>>
>>>Hi,
>>>Can we print the actual SQL that is made out of the
>>>Criteria.
>>>My selects work but inserts don't, I need to see the
>>>SQL as the following stack trace indicated syntax
>>>errors.
>>>
>>>Thanks
>>>
>>>Vijay
>>>      
>>>




---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
Tulsi,

I haven't ever used Log4J.

Could u guide how to configure that from my main
program if its not too much of a hassle.

Don't want to leave Torque and start leaning Log4J
now.

Thanks

Vikas

--- Tulsi Das <qu...@yahoo.com> wrote:
> or, better yet, you can setup Log4J to DEBUG level,
> and all queries get
> printed out to wherever you've configured it.
> 
> tulsi
> 
> 
>  --- Jeff Rasmussen <jr...@lnxi.com> escribi�: 
> > This should work. I've been using it.
> > 
> > Criteria crit = new Criteria();
> > ....
> > ....
> > ....
> > System.out.println(crit.toString());
> > 
> > Jeff Rasmussen
> > 
> > On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > > Hi,
> > > Can we print the actual SQL that is made out of
> the
> > > Criteria.
> > > My selects work but inserts don't, I need to see
> the
> > > SQL as the following stack trace indicated
> syntax
> > > errors.
> > > 
> > > Thanks
> > > 
> > > Vijay
> > > 
> > > -----------------------
> > > java.sql.SQLException: [SQL0104] Token ) was not
> > > valid. Valid tokens: DAY PATH YEAR LABEL MONTH
> OPTION
> > > RESULT CONNECTION TRANSACTION.
> > > 	at
> > >
>
com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
> > > 	at
> > >
> >
>
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1088)
> > > 	at
> > >
> >
>
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
> > > 	at
> > >
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
> > > 	at
> > >
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1371)
> > > 	at
> > >
> >
>
org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:271)
> > > 	at
> > >
> >
>
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:372)
> > > 	at
> > >
>
com.workingdogs.village.Record.saveWithInsert(Unknown
> > > Source)
> > > 	at com.workingdogs.village.Record.save(Unknown
> > > Source)
> > > 	at com.workingdogs.village.Record.save(Unknown
> > > Source)
> > > 	at
> > >
> >
>
org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:891)
> > > 	at
> > >
>
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:725)
> > > 	at
> > >
> >
>
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:218)
> > > 	at
> > >
> >
>
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:565)
> > > 	at
>
com.suz.torque.pitchers.BaseTeam.save(BaseTeam.java:1081)
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Free Pop-Up Blocker - Get it now
> > > http://companion.yahoo.com/
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail:
> torque-user-help@db.apache.org
> > > 
> > > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> torque-user-help@db.apache.org
> >  
> 
> ------------
> Los mejores usados y las m�s tentadoras 
> ofertas de 0km est�n en Yahoo! Autos.
> Compr� o vend� tu auto en
> http://autos.yahoo.com.ar
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Tulsi Das <qu...@yahoo.com>.
or, better yet, you can setup Log4J to DEBUG level, and all queries get
printed out to wherever you've configured it.

tulsi


 --- Jeff Rasmussen <jr...@lnxi.com> escribió: 
> This should work. I've been using it.
> 
> Criteria crit = new Criteria();
> ....
> ....
> ....
> System.out.println(crit.toString());
> 
> Jeff Rasmussen
> 
> On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > Hi,
> > Can we print the actual SQL that is made out of the
> > Criteria.
> > My selects work but inserts don't, I need to see the
> > SQL as the following stack trace indicated syntax
> > errors.
> > 
> > Thanks
> > 
> > Vijay
> > 
> > -----------------------
> > java.sql.SQLException: [SQL0104] Token ) was not
> > valid. Valid tokens: DAY PATH YEAR LABEL MONTH OPTION
> > RESULT CONNECTION TRANSACTION.
> > 	at
> > com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1088)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1371)
> > 	at
> >
>
org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:271)
> > 	at
> >
>
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:372)
> > 	at
> > com.workingdogs.village.Record.saveWithInsert(Unknown
> > Source)
> > 	at com.workingdogs.village.Record.save(Unknown
> > Source)
> > 	at com.workingdogs.village.Record.save(Unknown
> > Source)
> > 	at
> >
>
org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:891)
> > 	at
> > org.apache.torque.util.BasePeer.doInsert(BasePeer.java:725)
> > 	at
> >
> com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:218)
> > 	at
> >
> com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:565)
> > 	at com.suz.torque.pitchers.BaseTeam.save(BaseTeam.java:1081)
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>  

------------
Los mejores usados y las más tentadoras 
ofertas de 0km están en Yahoo! Autos.
Comprá o vendé tu auto en
http://autos.yahoo.com.ar

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Sonu Vijay <so...@yahoo.com>.
Thanks for your reply, there is something I missed.
I'm printing out the criteria. And I'm trying to
insert a record. The criteria.toString() gives me a
SELECT query. So I assumed that maybe BasePeer first
check if the record with that key exists and if not
then inserts it.

And if my assumption is true then after a SELECT I
should get an Insert SQL which I never get.

Selects are working fine, if I do only SELECTS I get
right results.

So I don't know what going on. First select and then
insert, is this how it works ?
If yes then where is the Insert Criteria created. And
I'm using all classes generated by Torque, right
insert method in my Peer and BasePeer is being called
but the Criteria that prints is a SELECT criteria and
not an Insert.

Don't know how to debug it.

Vijay



--- Jeff Rasmussen <jr...@lnxi.com> wrote:
> This should work. I've been using it.
> 
> Criteria crit = new Criteria();
> ....
> ....
> ....
> System.out.println(crit.toString());
> 
> Jeff Rasmussen
> 
> On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > Hi,
> > Can we print the actual SQL that is made out of
> the
> > Criteria.
> > My selects work but inserts don't, I need to see
> the
> > SQL as the following stack trace indicated syntax
> > errors.
> > 
> > Thanks
> > 
> > Vijay
> > 
> > -----------------------
> > java.sql.SQLException: [SQL0104] Token ) was not
> > valid. Valid tokens: DAY PATH YEAR LABEL MONTH
> OPTION
> > RESULT CONNECTION TRANSACTION.
> > 	at
> >
>
com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1088)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1371)
> > 	at
> >
>
org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:271)
> > 	at
> >
>
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:372)
> > 	at
> >
>
com.workingdogs.village.Record.saveWithInsert(Unknown
> > Source)
> > 	at com.workingdogs.village.Record.save(Unknown
> > Source)
> > 	at com.workingdogs.village.Record.save(Unknown
> > Source)
> > 	at
> >
>
org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:891)
> > 	at
> >
>
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:725)
> > 	at
> >
>
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:218)
> > 	at
> >
>
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:565)
> > 	at
>
com.suz.torque.pitchers.BaseTeam.save(BaseTeam.java:1081)
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> torque-user-help@db.apache.org
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Printing SQL

Posted by Jeff Rasmussen <jr...@lnxi.com>.
This should work. I've been using it.

Criteria crit = new Criteria();
....
....
....
System.out.println(crit.toString());

Jeff Rasmussen

On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> Hi,
> Can we print the actual SQL that is made out of the
> Criteria.
> My selects work but inserts don't, I need to see the
> SQL as the following stack trace indicated syntax
> errors.
> 
> Thanks
> 
> Vijay
> 
> -----------------------
> java.sql.SQLException: [SQL0104] Token ) was not
> valid. Valid tokens: DAY PATH YEAR LABEL MONTH OPTION
> RESULT CONNECTION TRANSACTION.
> 	at
> com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
> 	at
> com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1088)
> 	at
> com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
> 	at
> com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
> 	at
> com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1371)
> 	at
> org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:271)
> 	at
> org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:372)
> 	at
> com.workingdogs.village.Record.saveWithInsert(Unknown
> Source)
> 	at com.workingdogs.village.Record.save(Unknown
> Source)
> 	at com.workingdogs.village.Record.save(Unknown
> Source)
> 	at
> org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:891)
> 	at
> org.apache.torque.util.BasePeer.doInsert(BasePeer.java:725)
> 	at
> com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:218)
> 	at
> com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:565)
> 	at com.suz.torque.pitchers.BaseTeam.save(BaseTeam.java:1081)
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org