Anyone have any experience setting up Jasperserver to use MS SQL for the backend repository. I’m seeing some data with regards to Oracle, but not much on MS Sql server. I think I understand the basics, I would need to do a WAR installation and change Default Master Properties File, but I’m not sure how/where I would need to put the JDBC driver. Any help would be greatly appreciated.
14 Answers:
Could You please help me with some problems connected with connection between my MS SQL Server 2008 database and Jaspersoft ? There is a problem with adding a SQL 2008 Server as a DataSource to Jaspersoft.
I have been trying to make a connection between these two softwares fo whole day, but unsuccessfully I couldn't manage to solve the problem. I have done almost everything according to the article:
http://jasperforge.org/plugins/mwiki/index.php/Jasperserver/DataSources#Adding_a_Microsoft_SQL_Server_2008_Database_as_a_Data_Source
My server is named: MORSZYNSKA
DB: Morszynska_dane
User is: Administrator
no password
I'm not exactly sure if I put correct URL:
Is phrase: "jdbc:sqlserver://host:MORSZYNSKA;databaseName=Morszynska_dane" correct ?
What is more, should driver be:
com.microsoft.sqlserver.jdbc.SQLServerDriver
or
com.microsoft.sqlserver.jdbc4.SQLServerDriver ?
And the last question:
Shoul I install WAR File Distribution ? Is it necessary ?
Thank You for Your help in advance.
Kind regards,
Bartłomiej Siawrys
Tel.: +48 513 959 069
Mail: siawrys@synergy.pl
Synergy Polska Sp. z o.o.
Plac Rembowskiego 9A lokal 3
02-915 Warszawa
www.synergy.pl
So for the URL the Host name part of the URL is either an ip address or a DNS name that maps to an ip address. For example:
jdbc:sqlserver://MORSZYNSKA.com;databaseName=Morszynska_dane
or
jdbc:sqlserver://123.45.67.89;databaseName=Morszynska_dane
I used com.microsoft.sqlserver.jdbc.SQLServerDriver with success. With me a WAR distribution was not necissary, the Windows GUI installation was fine. Make sure you put the .jar file in the appropreate directory (C:\\Program Files (x86)\\jasperreports-server-cp-4.0.0\\apache-tomcat\\lib) or whatever is most appropreate and then restart jasper server. I don't believe that JasperServer supports DB's without passwords so you may have to put on a dummy password in order to connect.
If you need more in detail messages as to why your connection fails, you can download iReport and if you build the same connection in there, you can get more in depth error messages.
Sorry, but I still have problem with JasperReports Server.
I've managed to connect my DB using iReport, but I can't do that in JasperReports Server.
I use the same login, password, URL and Driver as in iReport, but there is still info that: "Connection failed". Why ?
For sure, I've copied
sqljdbc.jar
and
sqljdbc4.jar
to: C:\\Program Files\\jasperreports-server-4.1\\apache-tomcat\\lib and C:\\Program Files\\jasperreports-server-4.1\\apache-tomcat\\webapps\\jasperserver-pro\\WEB-INF\\lib
Why isn't it working ?
Bartłomiej Siawrys
Of course, I have restarted JasperReport Server. Still I have problems only with JasperReport Server, everything is just great with iReport.
Could anyone help me remotely (UltraVNC) ? I can provide my server IP adress and password via private message.
Thanks in advance.
BS
I'm also connecting to a remote SQL Server (2005) datasource for the first time using Jasperserver. I finally got the connection to work but it was lots of trouble. Is Ireport installed on a Windows machine? Is the Jasperserver also installed on a Windows machine? This may make a difference. I had all kinds of trouble with SQL Server authentication versus Windows Authentication.
I can finally connect to SQL Server 2005 via a datasource from both Windows laptop and Linux Fedora machine. However, I am now trying to figure out the cause of error when it executes a query. I'm getting "com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server supports holdability at the connection level only. ". This error did not occur when connecting from Jasperserver 4.01 on my Windows Laptop. The error happens in Linux Jasperserver 4.01. Thats why I ask about which environment IReport is installed in and which environment Jasperserver is installed in.
I will open a different thread on my problem if I can't figure it out within a few days.
*** 07/11/11 ***
My issue above was caused by a setting In jasperreports.properties: net.sf.jasperreports.jdbc.holdability=close
I had configured my laptop Jasperserver slightly differently than the production Linux one. Thats why it worked in
one environment but not another.
MS SQL Server won't allow a query to execute with the holdability setting set to close.
It throws an exception with message "SQL Server supports holdability at the connection level
only, use the connection.setHoldability() method".
Once I commented out the holdability and let it default, everything worked fine.
Post Edited by lhp at 07/11/2011 19:14
Hi,
Both iReport and JasperReport Server are installed on the same Windows Home Server. Are there problems if these 2 softwares are installed on the same machine ? ... strange. Please, write me some more details how did You connect Your SQL Server 2005 DB with Jaspersoft.
Thanks in advance.
BS
All my notes are related to using SQL Server authentication. I will share in next post. My notes are not relavant to Windows authentication so I will hold off until you let me know.
I'm using SQL Server authentication both in iReport and JasperReport Server. What is more, I'm not a client who is connected to Windows Home Server... I'm logged in, have an administratives privileges and I use Windows Home Server localy, not remotely... on the same machine where the MS SQL Server 2008 and JaspersReport Server are installed on. So, I hope this is the same situation You are describing.
I'm looking forward to Your post.
BS
Yes, same scenario only I'm using 2005 versus 2008. But that should not matter. With a local connection your connection string should probably just have localhost in it. Here is everything I ended up having to do to connect to SQL Server. Surely one or more of these must be causing your connection failure.
(1) port 1433 TCP/IP was not opened on the remote SQL Server. Adjusted firewall to allow it.
(2) In my case it was necessary to specify a named instance as part of the connection string.
(3) I had set up login credentials incorrectly on the remote SQL Server database. I had it set up as using Windows Authentication instead of SQL Server authentication. Add a new user account to your SQL server database. Don't use administrator account. Just a simple user (myuser) and then make sure that user has SQL Server authentication - not windows authentication.
(4) I had to make sure that the login credential had public and read access to tables
(5) Microsoft wouldn't accept my workgroup name so I just used the server's IP address in the connection string. If your server is in a domain and uses DNS, you probably won't run into this issue. This server was not in a domain.
(6) The database itself was only set up to use windows authentication. I had to change a property at the database level to enable access by both SQL Server authentication and Windows authentication.
(7) And of course restart SQL Server services so that the new settings would take.
(8) I had sqljdbc4.jar in the wrong place. It had to be under the lib directory of Apache Tomcat. NOT under the lib under webapps. Put it under the very first lib you see as you expand tomcat root. I'm using sqljdbc4.jar for the JDBC driver. This is the driver to use if you have jdk 1.6 installed on the server. You have to use a different JDBC driver if you have an earlier version of jdk. Make sure there are not 2 conflicting jdks on your server.
After I finally got a sucessful connection using Microsoft to Microsoft products, I created a SQL Server connection string like the one below that connected. It defaulted to port 1433 and it worked.
Named instance: jdbc:sqlserver://myServerNameOrIpAddress\\myNamedInstance;databaseName=myDatabaseName;
No Named instance: jdbc:sqlserver://myServerNameOrIpAddress;databaseName=myDatabaseName;
Post Edited by lhp at 07/12/2011 14:22