If your username is peter, put a file in src/main/resources/props named
peter.props
In that file, place the following lines:

db.driver=*the_name_name_of_your_driver*
db.url=*the_url_to_access_your_database*
db.user=*the_username*
db.password=*the_db_password*
test.me=true

**
**

Add the following line to Boot.scala:

println(Props.get("test.me")


When you run your app Full(true) should appear on the console and the
correct db settings should be picked up.

Thanks,

David

**

On Thu, Jun 18, 2009 at 3:49 PM, Peter Robinett <pe...@bubblefoundry.com>wrote:

>
> Hi all,
>
> I'm looking to switch a basic Lift install to use MySQL. I see that
> this has been addressed on the wiki (http://wiki.liftweb.net/index.php/
> HowTo_configure_lift_with_MySQL), though it involves hardcoding the
> connection details in Boot.scala. I'd like something easier to deploy
> to various machines.
>
> The thread following Jörn's announcement of the wiki page on MySQL is
> useful (http://groups.google.com/group/liftweb/browse_thread/thread/
> bd4e74b68e8aa2a9/9eb2c2ef39442d63) but none of them mention using
> properties files, which I understand from this mailing list (e.g.
>
> http://groups.google.com/group/liftweb/browse_thread/thread/49eb17b5dd6fc46a
> )
> is the best way store database settings.
>
> So, I created src/main/resources/props/peter.db.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd";>
> <properties>
>        <comment></comment>
>        <entry key="db.driver">com.mysql.jdbc.Driver</entry>
>        <entry key="db.url">jdbc:mysql://localhost/mydb</entry>
>        <entry key="db.user">myusername</entry>
>        <entry key="db.password">mypassword</entry>
> </properties>
>
> Unfortunately, the property file does appear to be loaded, as the
> DBVendor code in Boot.scala generated by the lift-archetype-basic
> archetype falls back to its derby defaults. Do you have any idea what
> I'm doing wrong? Not having any experience with Java, I wouldn't be
> surprised if it's something as simple as getting the properties XML
> wrong...
>
> Thanks for your help!
>
> Peter
>
> >
>


-- 
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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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