Jfinal下连接SQLServer

来源:互联网 发布:普通话考试训练软件 编辑:程序博客网 时间:2024/06/05 10:24

Config.java

public void configPlugin(Plugins me) {loadPropertyFile("classes/config.properties");C3p0Plugin cp = new C3p0Plugin(getProperty("jdbc.url"), getProperty("jdbc.username"), getProperty("jdbc.password"), getProperty("jdbc.driverClassName"));                                         //关键:使用C3P0me.add(cp);ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);me.add(arp);arp.setDialect(new AnsiSqlDialect());//关键:使用AnsiSqlDialectarp.setContainerFactory(new CaseInsensitiveContainerFactory());}

config.properties

##-------------------------------------------------## SQL Server##-------------------------------------------------jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriverjdbc.url=jdbc:sqlserver://localhost:1433;DatabaseName=dbnamejdbc.username=sajdbc.password=123456jdbc.dbType=sqlserver


0 0
原创粉丝点击