[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
In the Boot.scala ### class Boot { def boot { if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor) ... } } object WahDB extends ConnectionIdentifier { def jndiName = one } object WahereDB extends ConnectionIdentifier { def

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
Here is the db url, db.url1=jdbc:mysql://localhost:3306/blog1 db.url2=jdbc:mysql://localhost:3306/blog2 Cheers, Neil On Dec 6, 4:00 pm, Neil.Lv anim...@gmail.com wrote: In the Boot.scala ### class Boot {   def boot {     if (!DB.jndiJdbcConnAvailable_?)      

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
If i remove the DB.defineConnectionManager (DefaultConnectionIdentifier, DBVendor) This error message occurs. ### java.lang.NullPointerException: Looking for Connection Identifier ConnectionIden tifier(lift) but failed to find either a JNDI data source with the name lift or a lift

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
I don't understand the jndiName whether the jndiName is whatever string that i can specify ? ### object OneDB extends ConnectionIdentifier { def jndiName = one } ### Cheers, Neil On Dec 6, 7:54 pm, Tim Nelson tnell...@gmail.com wrote: Hi, This line configures the database connections:

Re: [Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Tim Nelson
I think there might be a problem with the way you are specifying which db to use in your mapper classes. Here's the relevant text from the The Lift Book: dbSelect... is used to find an instance by primary key, and takes a partial function (typically a match clause) to determine which connection

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
Yeah, i don't want to use sharding, i just want select some information from another databases, ### object Blog extends Blog with LongKeyedMetaMapper[Blog ] { ... override def dbDefaultConnectionIdentifier = OneDB ... } ### It doesn't work, maybe the code that i write is wrong ?

Re: [Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Tim Nelson
I did some more digging and got a sample app to work. You can see the code here: http://github.com/eltimn/lift_1_1_sample There are 2 things I had to do. The first is to pass in the DbId when calling Schemifier; Schemifier.schemify(true, Log.infoF _, OneDB, User) Schemifier.schemify(true,

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
Thanks Tim, I have tried it in my code but it doesn't work yet! The lift version is: 1.1-M7 Scala Version is: 2.7.7 Cheers, Neil On Dec 6, 10:52 pm, Tim Nelson tnell...@gmail.com wrote: I did some more digging and got a sample app to work. You can see the code

[Lift] Re: How to configure two database connection in Lift?

2009-12-06 Thread Neil.Lv
It works now, I missing the dbDefaultConnectionIdentifier definition in the others models. Thank you very much! :) Cheers, Neil On Dec 7, 12:06 am, Neil.Lv anim...@gmail.com wrote:   Thanks Tim,   I have tried it in my code but it doesn't work yet!   The lift version is:  1.1-M7

[Lift] Re: How to configure two database connection in Lift?

2009-12-05 Thread Neil.Lv
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

Re: [Lift] Re: How to configure two database connection in Lift?

2009-12-05 Thread Alex Boisvert
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

[Lift] Re: How to configure two database connection in Lift?

2009-12-05 Thread Neil.Lv
The two databases that have different structure of the tables, such as two applications databases. Cheers, Neil On Dec 6, 2:38 pm, Neil.Lv anim...@gmail.com wrote:    Btw, there is the error message when the server is started. ### scala.MatchError: ConnectionIdentifier(lift) ### On