Jump to content
Changes to the Jaspersoft community edition download ×

Can't configure JDBC connection to SQL Server


david.tessierlive.com
Go to solution Solved by david.tessierlive.com,

Recommended Posts

I have been struggling to connect jasper reports to my SQL Server 2008. 

 

I've tried a few different drivers, and it appears I'm able to connect, but it always complains about my user ID. I know I can connect with these credentials as I use SSMS all the time with them. I've tried doing a few things, like adding our domain to the server in the connection string, or prefixing my user id with domainusername. It still tells me "login failed for user 'me'"

 

I've tried net.sourceforge.jtds.jdbc.Driver and com.microsoft.sqlserver.jdbc.SQLServerDriver

 

I made sure that the proper driver is set in the classpath. (if they weren't we wouldn't see it even connect, let alone tell me my user failed) 

 

Is there a setting that I have to have enabled on my SQL Server to allow JDBC connections? 

 

Any ideas? 

 

**net.sourceforge.jtds.jdbc.Driver** 

Here's the connection string 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[/code]
    

    

**com.microsoft.sqlserver.jdbc.SQLServerDriver**  

Connection string: 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
[/code]
    

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution
The comments in the following link were the issue I had.


 

When you install the JDBC driver for the first time you have to copy this file

/Program Files/Microsoft JDBC Driver 4.0 for SQL Serversqljdbc_4.0/enu/auth/x64/sqljdbc_auth.dll

to the Java Run Time Environment bin folder

C:Program FilesJavajre7bin

then later if you upgrade your java to a higher version, you have to copy the file again and so on.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...