Do a println to output the value of Props.get("db.driver")
On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv <[email protected]> wrote:
>
> It generated by the archetype lift-archetype-basic.
>
> ###### in the Boot.scala
> object DBVendor extends ConnectionManager {
> private var pool: List[Connection] = Nil
> private var poolSize = 0
> private val maxPoolSize = 4
>
> private def createOne: Box[Connection] = try {
> val driverName: String = Props.get("db.driver") openOr
> "org.apache.derby.jdbc.EmbeddedDriver"
>
> val dbUrl: String = Props.get("db.url") openOr
> "jdbc:derby:lift_example;create=true"
>
> Class.forName(driverName)
>
> val dm = (Props.get("db.user"), Props.get("db.password")) match {
> case (Full(user), Full(pwd)) =>
> DriverManager.getConnection(dbUrl, user, pwd)
>
> case _ => DriverManager.getConnection(dbUrl)
> }
>
> Full(dm)
> } catch {
> case e: Exception => e.printStackTrace; Empty
> }
>
> def newConnection(name: ConnectionIdentifier): Box[Connection] =
> synchronized {
> pool match {
> case Nil if poolSize < maxPoolSize =>
> val ret = createOne
> poolSize = poolSize + 1
> ret.foreach(c => pool = c :: pool)
> ret
>
> case Nil => wait(1000L); newConnection(name)
> case x :: xs => try {
> x.setAutoCommit(false)
> Full(x)
> } catch {
> case e => try {
> pool = xs
> poolSize = poolSize - 1
> x.close
> newConnection(name)
> } catch {
> case e => newConnection(name)
> }
> }
> }
> }
>
> def releaseConnection(conn: Connection): Unit = synchronized {
> pool = conn :: pool
> notify
> }
> }
>
> ######
>
> And this is my default.props (In src\main\resources\props )
> Only this file in the props folder.
>
> ###
> db.driver=com.mysql.jdbc.Driver
> db.url=jdbc:mysql://localhost:3306/project
> db.user=root
> db.password=root
> ###
>
> Cheers,
> Neil
>
>
> On Nov 28, 7:57 pm, Timothy Perrett <[email protected]> wrote:
> > Paste your database connection object? its probably that you copied the
> one from lift examples and you are now missing the correct properties
> file...
> >
> > Cheers, Tim
> >
> > On 28 Nov 2009, at 10:26, Neil.Lv wrote:
> >
> > > Hi all,
> >
> > > I have a silly question about the lift app that deployed on the
> > > Jetty server.
> >
> > > Can't find the jdbc:mysql driver in Production Mode ? It will use
> > > the derby to instead of the mysql.
> >
> > > But it works fine in the Development Mode.
> >
> > > I will craete the derby file in the jetty folder.
> > > /home/jetty6/derby.log
> > > /home/jetty6/lift-example
> >
> > > 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 [email protected].
> > > To unsubscribe from this group, send email to
> [email protected]<liftweb%[email protected]>
> .
> > > For more options, visit this group athttp://
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
--
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.