开发者

can not retrieve data from sql server

开发者 https://www.devze.com 2023-02-11 04:44 出处:网络
I can not retrieve data from db in sql server. I use the c3p0 as the pool,this is the c3p0.properties:

I can not retrieve data from db in sql server.

I use the c3p0 as the pool,this is the c3p0.properties:

开发者_开发技巧c3p0.user=test
c3p0.password=123456
c3p0.jdbcUrl=jdbc:sqlserver://xxxxxx:1433;databaseName=TIMDB;SelectMethod=cursor
c3p0.driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
c3p0.maxPoolSize=15
c3p0.testConnectionOnCheckin=true
c3p0.idleConnectionTestPeriod=3600

In the sql server,I have create a new user named test,and its default db is TIMDB,the server roles is public,and this is the user mapping:

can not retrieve data from sql server

But when I start the application,I can get nothing.

From the log created by log4j,I can get the sql used to retrieve data,but if I copy the sql to the sql management stutio and create a new query,I can retrieve some data.

I wonder why?


It looks like a permissions problem to me. If the generated SQl runs when you use it in management studio (i.e under your user account) then you know the code is good. What access have you given the user "test" from your post I see "user mapping: enter image description here"? he will need at least db_datareader and possibly more depending on what code is generated.

You could also try logging on to SQL Management studio under your "test" user and see if you can execute the code. That will eliminate the possibility that its something wrong with your application/network.

0

精彩评论

暂无评论...
验证码 换一张
取 消