无法配置与SQL Server的JDBC连接

时间:2016-02-29 17:29:43

标签: jdbc jasper-reports

我一直在努力将jasper报告连接到我的SQL Server 2008.

我尝试了一些不同的驱动程序,看起来我可以连接,但它总是抱怨我的用户ID。我知道我可以连接这些凭据,因为我一直使用SSMS。我尝试过做一些事情,比如在连接字符串中将我们的域添加到服务器,或者使用domain \ username添加我的用户ID。它仍然告诉我“登录失败的用户'我'”

我已尝试net.sourceforge.jtds.jdbc.Drivercom.microsoft.sqlserver.jdbc.SQLServerDriver

我确保在类路径中设置了正确的驱动程序。 (如果他们不是我们甚至不会看到连接,更不用说告诉我我的用户失败了)

我是否必须在SQL Server上启用允许JDBC连接的设置?

有什么想法吗?

net.sourceforge.jtds.jdbc.Driver
这是连接字符串jdbc:jtds:sqlserver://servername/database

net.sf.jasperreports.engine.JRException: java.sql.SQLException: Login failed for user 'me'.
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.contributeParameters(JdbcDataAdapterService.java:130)
at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:128)
at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.runOperations(AbstractDataAdapterWizard.java:162)
at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:59)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Login failed for user 'me'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.getConnection(JdbcDataAdapterService.java:168)
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.contributeParameters(JdbcDataAdapterService.java:128)
... 4 more

com.microsoft.sqlserver.jdbc.SQLServerDriver
连接字符串:jdbc:sqlserver://servername:1433;databaseName=database

net.sf.jasperreports.engine.JRException: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'me'. ClientConnectionId:1a482dde-a84f-4e8b-9571-cb5a9dcfcfc9
    at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.contributeParameters(JdbcDataAdapterService.java:130)
    at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:128)
    at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.runOperations(AbstractDataAdapterWizard.java:162)
    at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:59)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'me'. ClientConnectionId:1a482dde-a84f-4e8b-9571-cb5a9dcfcfc9
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
    at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
    at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
    at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.getConnection(JdbcDataAdapterService.java:168)
    at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.contributeParameters(JdbcDataAdapterService.java:128)
    ... 4 more

我已添加此视频以显示问题。 https://www.youtube.com/watch?v=nPfJXYo6q9U

0 个答案:

没有答案