Assumptions:
REMOTE_IP is the ip address sql server is bound to port 1433 listening for tcp/ip traffic. And database name is jasper.
Instead of using the plain ole sqljdbc.jar driver to connect to SQL Server, we will utilize a product called jTDS to connect to the SQL Server. This is because it allows JDBC to connect to SQL server using Windows Authentication mode instead of SQL mode.
Steps:
- Install jasper server 4.5.x
-
Get jTDS 1.2.5 (or whatever is latest should work).
You may have noticed that there is a few DLLs in that jTDS package. Don't worry! The driver still works in Linux. You just cannot do single-sign on in Linux of course like Windows can.
Extract jtds-*.jar to $jasperserver/apache-tomcat/lib
-
Edit $jasperserver/apache-tomcat/conf/Catalina/localhost/jasperserver.xml and add the following element before </Context>
-
Edit $jasperserver/apache-tomcat/webapps/jasperserver/WEB-INF/web.xml and add a new <resource-ref> for the new datasource:
Connection Description jdbc/sqlserver javax.sql.DataSource Container
-
Create a new database name "jasper" and grant read* permissions to the Active Directory account you desire to use.
-
Run this script for test purposes:
create table test (test varchar(50) NULL) insert into test values ('1') insert into test values ('2') insert into test values ('3')
-
Create a new JSP file $jasperserver/apache-tomcat/webapps/jasperserver/test.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query datasource="jdbc/sqlserver" var="rs"> select test from test </sql:query>
<html><head> <title>DB Test</title> </head> <body>
Results
<c:forEach var="i" items="${rs.rows}"> Text Message: <c:out value="${i.test}"/> </c:forEach> </body></html>[/code]
- Start jasperserver's tomcat. Login, and test http://localhost:8080/jasperserver/test.jsp
You should see the rows 1, 2 and 3 from the test table.
If it doesn't work... review the previous steps and see what went wrong.
- Simply create a jasper server JNDI datasource by going to: Datasources -> New Data source -> Type: JNDI data source. -> JNDI lookup is: /jdbc/sqlserver
- Create your tables and test your report.
Recommended Comments
There are no comments to display.
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 accountSign in
Already have an account? Sign in here.
Sign In Now