如何返回sqlserver 中存储过程的select的结果集

2024-11-17 16:23:45
推荐回答(1个)
回答(1):

Config.java

1
2
3
4
5
6
7
8
9

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")); //关键:使用C3P0
me.add(cp);
ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
me.add(arp);
arp.setDialect(new AnsiSqlDialect());//关键:使用AnsiSqlDialect
arp.setContainerFactory(new CaseInsensitiveContainerFactory());
}

config.properties

1
2
3
4
5
6

jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

jdbc.url=jdbc:sqlserver://localhost:1433;DatabaseName=dbname
jdbc.username=sa
jdbc.password=123456
jdbc.dbType=sqlserver