Duplicate Querying??

11 views
Skip to first unread message

sailor...@gmail.com

unread,
May 6, 2009, 11:41:45 AM5/6/09
to Lift
HI :

I turned on the SQL in Boot.scala by
DB.addLogFunc((query, len) => Log.info("The query: "+query+" took "+len
+" milliseconds"))

However I found for each query, it generates two actual querys, at
least in log it shows two.
The first one seems to be real, but the second one is always with some
"** NOT SPECIFIED **"

for example

[INFO] Starting scanner at interval of 5 seconds.
23:24:11.501 [31720052@qtp-4321831-0] INFO lift - The query:
com.mysql.jdbc.JDB
C4PreparedStatement@3d12a6: SELECT DISTINCT room.id, room.room_name,
room.room_
comment, room.day_minutes, room.night_minutes, room.max_user,
room.room_flags, r
oom.status, room.victory, room.created, room.updated FROM room WHERE
id = 1 t
ook 16 milliseconds
23:24:11.501 [31720052@qtp-4321831-0] INFO lift - The query:
com.mysql.jdbc.JDB
C4PreparedStatement@3d12a6: SELECT DISTINCT room.id, room.room_name,
room.room_
comment, room.day_minutes, room.night_minutes, room.max_user,
room.room_flags, r
oom.status, room.victory, room.created, room.updated FROM room WHERE
id = ** N
OT SPECIFIED ** took 31 milliseconds

The second query is exactly the same just the id becomes ** NOT
SPECIFIED ** ?
I wonder why this would happen.

Thanks for the help.

Note: All other DB queries seem to be duplicated in the same way too.

David Pollak

unread,
May 6, 2009, 1:26:35 PM5/6/09
to lif...@googlegroups.com
That's because there are two round-trips to the RDBMS.  The first one is the preparation of the PreparedStatement and the second one is the execution of the bound prepared statement.  There's only one query that's executed, but there are two calls into the JDBC infrastructure.
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

sailor...@gmail.com

unread,
May 8, 2009, 3:46:43 AM5/8/09
to Lift
Thanks. Any idea to remove the redundant logs?

On 5月7日, 上午1時26分, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> That's because there are two round-trips to the RDBMS. The first one is the
> preparation of the PreparedStatement and the second one is the execution of
> the bound prepared statement. There's only one query that's executed, but
> there are two calls into the JDBC infrastructure.
>
> On Wed, May 6, 2009 at 8:41 AM, sailormoo...@gmail.com <
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp- 隱藏被引用文字 -
>
> - 顯示被引用文字 -

David Pollak

unread,
May 8, 2009, 8:37:14 AM5/8/09
to lif...@googlegroups.com




Thanks. Any idea to remove the redundant logs?

They are not redundant.  They each represent a JDBC operation.
 



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890

Chao Ye

unread,
Mar 27, 2017, 11:31:11 AM3/27/17
to Lift, feeder.of...@gmail.com
Dear David Pollak,
I also met the problem when I used the jdbc.PreparedStatement, the sql='SELECT * FROM compartment where WID=? and name=?'; however the error is 
com.mysql.jdbc.JDBC4PreparedStatement@2d34520f: SELECT * FROM compartment where WID=** NOT SPECIFIED ** and name=** NOT
SPECIFIED **
Would you please tell me how to solve this problem?
Best wishes!
Chao

在 2009年5月7日星期四 UTC+8上午1:26:35,David Pollak写道:

Antonio Salazar Cardozo

unread,
Mar 27, 2017, 12:45:31 PM3/27/17
to Lift
Hello Chao,
Two notes:

 - In general, bumping a thread that is 8 years old is frowned upon. This is because
   generally speaking a code base has changed significantly over the course of such
   a long time. Please post a new thread with the specific issue you're seeing and more
   details about how you're invoking the prepared statement. The error itself is very
   generic, so we'll need more details to reproduce your issue. One good way to approach
   this is to create an example project that shows the issue.
 - Using bold for your text generally implies emphasis for the content of your message.
   Using it for your whole message makes it harder to read, so it would be appreciated if,
   when you open the new thread, you avoid bolding the message :)

Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages