Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting to sqlserver2008 #18

Open
wenbin151 opened this issue Oct 8, 2018 · 5 comments
Open

Error connecting to sqlserver2008 #18

wenbin151 opened this issue Oct 8, 2018 · 5 comments
Assignees

Comments

@wenbin151
Copy link

wenbin151 commented Oct 8, 2018

Configuration:

db.db2.impl=act.db.ebean.EbeanPlugin
db.db2.url=jdbc:sqlserver://172.168.1.110;databasename=erpdb;autoReconnect=true;selectmethod=cursor
db.db2.username=sa
db.db2.password=1234
db.db2.databasePlatformName=sqlserver17

Error log:

org.osgl.exception.ConfigurationException: Error init SQL db service
	at org.osgl.util.E.invalidConfiguration(E.java:300)
	at act.db.sql.SqlDbService$1.run(SqlDbService.java:121)
	at act.db.sql.SqlDbService$1.on(SqlDbService.java:82)
	at act.event.EventBus.callOn(EventBus.java:1312)
	at act.event.EventBus.access$1400(EventBus.java:53)
	at act.event.EventBus$4.run(EventBus.java:1341)
	at act.job.JobManager$ContextualJob$1.apply(JobManager.java:460)
	at act.job.Job.doJob(Job.java:350)
	at act.job.Job.run(Job.java:287)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
	at java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PersistenceException: java.lang.IllegalArgumentException: For SqlServer please explicitly choose either sqlserver16 or sqlserver17 as the platform via ServerConfig.setDatabasePlatformName. Refer to issue #1340 for more details
	at io.ebeaninternal.server.core.DatabasePlatformFactory.create(DatabasePlatformFactory.java:66)
	at io.ebeaninternal.server.core.DefaultContainer.setDatabasePlatform(DefaultContainer.java:270)
	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:130)
	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:45)
	at io.ebean.EbeanServerFactory.createInternal(EbeanServerFactory.java:109)
	at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:70)
	at act.db.ebean.EbeanService.dataSourceProvided(EbeanService.java:114)
	at act.db.sql.SqlDbService.doInitDataSource(SqlDbService.java:263)
	at act.db.sql.SqlDbService.initDataSource(SqlDbService.java:245)
	at act.db.sql.SqlDbService.access$000(SqlDbService.java:54)
	at act.db.sql.SqlDbService$1.run(SqlDbService.java:95)
	... 15 common frames omitted
Caused by: java.lang.IllegalArgumentException: For SqlServer please explicitly choose either sqlserver16 or sqlserver17 as the platform via ServerConfig.setDatabasePlatformName. Refer to issue #1340 for more details
	at io.ebeaninternal.server.core.DatabasePlatformFactory.byDatabaseMeta(DatabasePlatformFactory.java:144)
	at io.ebeaninternal.server.core.DatabasePlatformFactory.byDataSource(DatabasePlatformFactory.java:123)
	at io.ebeaninternal.server.core.DatabasePlatformFactory.create(DatabasePlatformFactory.java:63)
	... 25 common frames omitted
@wenbin151
Copy link
Author

wenbin151 commented Oct 8, 2018

Caused by: javax.persistence.PersistenceException: java.lang.IllegalArgumentException: 
For SqlServer please explicitly choose either sqlserver16 or sqlserver17 as the platform via ServerConfig.setDatabasePlatformName. 
Refer to issue #1340 for more details

@wenbin151
Copy link
Author

wenbin151 commented Oct 8, 2018

跟踪代码是发现 initDataSourcedataSourceProvided 时没有把 sqlserver2008 特有的参数databasePlatformName 独立传递给 DataSourceConfig dsConfig 带入到这个方法里面,而是放在了customProperties 里面,ebeanConfig 创建数据库🔗时没有单独处理 customProperties 里面的参数。所以报上文错误

@wenbin151
Copy link
Author

wenbin151 commented Oct 8, 2018

Specifically on

at io.ebeaninternal.server.core.DatabasePlatformFactory.create(DatabasePlatformFactory.java:63)
public DatabasePlatform create(ServerConfig serverConfig) {
...
serverConfig.getDatabasePlatformName()  没有拿到这个配置,所以抛错
...
}

@greenlaw110 greenlaw110 changed the title 加载并读取sqlserver2008数据库包驱动错误 Error connecting to sqlserver2008 Oct 9, 2018
@wenbin151
Copy link
Author

act 1.8.8.6 act-bean1.7.3 测试ok。启动没有错误,读取数据ok。

@greenlaw110
Copy link
Contributor

reopen it till the version is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants