I have Jasper Server 4.5.0 64-bit running on Linux.
One of the many data sources the Jasper Server plugs into is a SQL Server with no Local SQL authentication parameters available.
How can I connect to the database using an Active Directory account instead of a local SQL account?
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:
1) Install jasper server 4.5.x
2) Get jTDS 1.2.5 (or whatever is latest should work).
Extract jtds-*.jar to $jasperserver/apache-tomcat/lib
3) Edit
$jasperserver/apache-tomcat/conf/Catalina/localhost/jasperserver.xmland add the following element before</Context>4) Edit
$jasperserver/apache-tomcat/webapps/jasperserver/WEB-INF/web.xmland add a new<resource-ref>for the new datasource:5) Create a new database name “jasper” and grant read* permissions to the Active Directory account you desire to use.
6) Run this script for test purposes:
7) Create a new JSP file
$jasperserver/apache-tomcat/webapps/jasperserver/test.jsp8) Start jasperserver’s tomcat. Login, and test
http://localhost:8080/jasperserver/test.jspYou 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.
9) Simply create a jasper server JNDI datasource by going to: Datasources -> New Data source -> Type: JNDI data source. -> JNDI lookup is:
/jdbc/sqlserverCreate your tables and test your report.