Can't configure JDBC connection to SQL Server

0
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 domain\username. 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
**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
david.tessier's picture
Joined: Feb 4 2016 - 5:24am
Last seen: 2 years 5 months ago

2 Answers:

0
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 Files\Java\jre7\bin
then later if you upgrade your java to a higher version, you have to copy the file again and so on.
david.tessier's picture
Joined: Feb 4 2016 - 5:24am
Last seen: 2 years 5 months ago
0

Tried both jdbc drivers and they both work. Do you have tcp enabled in your sql server?

If you know Japanese, take a look at the following wiki page:

http://community.jaspersoft.com/wiki/ms-sql-servernodetaworepotodeshi-itai

hozawa's picture
43019
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 week 9 hours ago
Feedback