I haven't used multiple connections myself, but I think you have two issues,

1) The default connection identifier is "lift" so you have to define a
connection with that name otherwise you'll have to override all Mapper
objects to use a different connection.

2) Your dbCalculateConnectionIdentifier method should look like,

override def dbCalculateConnectionIdentifier = {
   case _ => Two
}

meaning, regarless of the mapped object's value, use connection "Two".

and if you always use the same connection for all objects of a given mapper
(i.e., you're not sharding) then you can alternatively override the
MetaMapper object's dbDefaultConnectionIdentifier method.

Hope this helps,
alex

On Sat, Dec 5, 2009 at 10:38 PM, Neil.Lv <anim...@gmail.com> wrote:

>
>
>   Btw, there is the error message when the server is started.
> ###
> scala.MatchError: ConnectionIdentifier(lift)
> ###
>
> On Dec 6, 1:47 pm, "Neil.Lv" <anim...@gmail.com> wrote:
> > Hi all,
> >
> >   I want to use two databases, but i don't know how to configure it.
> >
> >   Does anybody know that how to configure two database connection in
> > Lift?
> >
> > 1:
> >   I add two ConnectionIdentifier in the Boot.class
> > ###
> > object OneDB extends ConnectionIdentifier {
> >
> >   def jndiName = "one"
> >
> > }
> >
> > object TwoDB extends ConnectionIdentifier {
> >
> >   def jndiName = "two"
> >
> > }
> >
> > ###
> >
> > 2: In the User model
> >
> >    How can i write the code in the method,
> > ###
> >   override def dbCalculateConnectionIdentifier = {
> >     Two
> >   }
> > ###
> >
> >   Thanks for any suggestion!
> >
> > Cheers,
> >   Neil
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to