日期:2014-05-20  浏览次数:20885 次

java连接数据库

java 连接数据库成功,但对表“鱼类菜谱”查询时提示:

  拒绝了对对象“ 鱼类菜谱'' (数据库 'huangsuyuan2011',架构 'dbo')的 SELECT 权限。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(Unknown Source)
at dao1.Xuancai.yulei(Xuancai.java:28)
at dao1.Menu.showMainMenu(Menu.java:66)
at dao1.Menu.showLoginMenu(Menu.java:32)
at dao1.Test.main(Test.java:10)


------解决方案--------------------
这个应该是你对那张表的没有查询权限把,用grand语句试试