jFinal怎样连接sqlserver?

数据库用的:sqlserver 2005

配置信息也修改了:

/**
	 * 配置插件
	 */
	public void configPlugin(Plugins me) {
		// 配置C3p0数据库连接池插件
		C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password"),getProperty("driver"));
		me.add(c3p0Plugin);
		
		// 配置ActiveRecord插件
		ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
		me.add(arp);
		arp.addMapping("blog", Blog.class);	// 映射blog 表到 Blog模型
	}

数据库表也建好了

用你提供的demo启动时报错如下:

好像是说数据库中没有这个表。

请问是什么原因造 成的?是不是不支持sqlserver啊?还是需要额外的设置Dialect?

谢谢

主键已设置自增,遇到同样问题,SqlServer会出IDENTITY_INSERT。。。。

原因是com.jfinal.plugin.activerecord.dialect.AnsiSqlDialect里返回的insert语句包含主键自增字段

我的解决办法:

AnsiSqlDialect第45行

if (tableInfo.hasColumnLabel(colName))

改为

if (tableInfo.hasColumnLabel(colName) 
    && !tableInfo.getPrimaryKey().equals(colName))
原文地址:https://www.cnblogs.com/alwaysy/p/3180684.html