第一步:在pom.xml文件下的<dependencies></dependencies>处加入如下代码:
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.3-603.jdbc3</version>
</dependency>
在Boot类是加入如下代码:
1、 object DBVendor extends ConnectionManager {
def newConnection(name: ConnectionIdentifier) = {
try {
Class.forName("org.postgresql.Driver")
val dm = DriverManager.getConnection("jdbc:postgresql ://localhost/zhaodao-lift","postgres","000000")
Full(dm)
} catch {
case e : Exception => e.printStackTrace; Empty
}
}
def releaseConnection(conn: Connection) {conn.close}
}
DB.defineConnectionManager(DefaultConnectionIdentifier,DBVendor)
这样在lift-web下配置postgresql数据就已经完成了
参考网站
http://wiki.liftweb.net/index.PHP/How_to_configure_lift_with_Postgresql
原文链接:https://www.f2er.com/postgresql/197148.html