Hi all,
I use two db connections in my app, and I want to use
DB.prepareStatement to select
the records from the second db.
It failed, Here is the code:
###
def getHotByTid(id : Long) =
DB.use(bootstrap.liftweb.TwoDB) {
conn =>
DB.prepareStatement("SELECT * FROM hots WHERE id=? ", conn) {
stmt =>
stmt.setLong(1, id)
Log.info("stmt :" + stmt) // The information is correctly now, but
after call executeUpdate method
stmt.executeUpdate()
}
}
###
The update statement can works well:
###
def updateCountsById(id : Long) =
DB.use(bootstrap.liftweb.TwoDB) {
conn =>
DB.prepareStatement("UPDATE hots set count=count+1 WHERE id=?",
conn) {
stmt =>
stmt.setLong(1, id)
stmt.executeUpdate()
}
}
###
Thanks for any suggestion that will be appreciated.
Cheers,
Neil
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.