如何连接Lift和MySQL? [英] How to connect lift and MySQL?

查看:86
本文介绍了如何连接Lift和MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个简单的Lift Web应用程序,该应用程序读取输入表单并将其插入数据库.

I want to create a simple lift web application which read input throug form and insert it into database.

推荐答案

您需要将mysql jdbc驱动程序添加到您的项目中(作为Maven构件,或通过sbt,或只是将jar放在CLASSPATH中)并编辑属性文件(道具/default.props):

You need to add mysql jdbc driver to your project (as a maven artifact, or via sbt, or just put jar in CLASSPATH) and edit properties file (props/default.props):

db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost/your_db_name
db.user=user
db.password=password

此外,您可以改为在应用程序容器(Tomcat等)中设置数据库上下文.之后,您可以使用Lift的ORM(映射器).

Also, you can setup db context in app container (Tomcat, etc.) instead. After that you can use Lift's ORM (Mapper).

这篇关于如何连接Lift和MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆