Monday, 5 August 2013

NextReports: add your JDBC driver

Starting from version 6.2 NextReports will allow users to add their own JDBC drivers. We are using Vertica JDBC driver here as example. In version 6.2 Vertica driver will be added by default.

Such process can be resumed by following steps :

1. JDBC jar driver is added inside lib folder (designer and server). From 7.0, designer has a jdbc-drivers folder.

2. Driver must be added in driver_templates.xml which can be found :
  • inside designer in installation folder in \lib\nextreports-designer-6.1.jar 
  • inside server in installation folder in \webapps\nextserver\WEB-INF\classes 


3. You need to create a Dialect class for that type of driver. This dialect does a mapping between database types and java sql types and has some utilities methods.
import java.sql.Types;
import ro.nextreports.engine.util.ProcUtil;

public class VerticaDialect extends AbstractDialect {

public VerticaDialect() {
registerColumnType("binary", Types.BLOB);
registerColumnType("varbinary", Types.BLOB);
registerColumnType("bytea", Types.BLOB);
registerColumnType("raw", Types.BLOB);
registerColumnType("boolean", Types.BOOLEAN);
registerColumnType("char", Types.CHAR);
registerColumnType("varchar", Types.VARCHAR);
registerColumnType("date", Types.DATE);
registerColumnType("timestamp", Types.TIMESTAMP);
registerColumnType("timestamp with timezone", Types.TIMESTAMP);
registerColumnType("datetime", Types.TIMESTAMP);
registerColumnType("smalldatetime", Types.TIMESTAMP);
registerColumnType("double precision", Types.DOUBLE);
registerColumnType("float", Types.FLOAT);
registerColumnType("float8", Types.FLOAT);
registerColumnType("real", Types.DOUBLE);
registerColumnType("bigint", Types.BIGINT);
registerColumnType("smallint", Types.SMALLINT);
registerColumnType("integer", Types.INTEGER);
registerColumnType("int", Types.INTEGER);
registerColumnType("tinyint", Types.INTEGER);
registerColumnType("int8", Types.INTEGER);
registerColumnType("decimal", Types.INTEGER);
registerColumnType("numeric", Types.NUMERIC);
registerColumnType("number", Types.NUMERIC);
registerColumnType("money", Types.NUMERIC);
registerColumnType("time", Types.TIME);
registerColumnType("time with timezone", Types.TIME);
registerColumnType("interval", Types.TIME);

public String getCurrentDate() throws DialectException {
return "current_date";

public String getCurrentTimestamp() throws DialectException {
return "current_timestamp";

public String getCurrentTime() throws DialectException {
return "current_time";

public String getCurrentDateSelect() {
return "select current_date";

public String getRecycleBinTablePrefix() {
return null;

public String getCursorSqlTypeName() {
return ProcUtil.REF_CURSOR;

public int getCursorSqlType() {
return Types.OTHER;

public String getSqlChecker() {
return "select 1";
    4. You must register the dialect in NextReports. To make this happen in designer and server you have to add some java VM parameters. (nextreports.vmoptions  file from designer and start-nextserver.vmoptions from server)
    -Dnext.dialect.database_1="Vertica Database" 

    First parameter must be the name taken from DataBaseMetaData.getDatabaseProductName().

    If you need to register more dialects, you use different suffix indexes.


    1. Hi all,
      I'm trying to add the as400 jdbc driver to next-reports (designer). However, I'm up to the point that I can add the connection details and that next-reports finds the jt400.jar file (put it in the jdbc-drivers directory). When trying to connect I get the error 'Could not get Dialect'. Which makes sense as I cannot find how to add the file to next-reports. The last sentence in the blog is 'First parameter must be the name taken from DatabaseMetaData.getDatabaseProductName()' which I do not understand just as the process of adding the file. Can anyone help me out here?
      To further clarify, when saving the connection I am able to browse the schemas on the as400/iSeries but cannot see the tables below.

    2. Furthermore, after unpacking the nextreports-designer.jar file, I've added the driver to driver_template(s).xml but when trying to add a new datasource, it does not see the new datasource. Do I need to make the jar again with the modified driver_template(s).xml?

    3. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

      Java Online Training

    4. I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.
      Java Courses in chennai

    5. Thanks For Sharing Your Information Please Keep UpDating Us The Information Shared Is Very Valuable Time Went On Just Reading The Article Python Online Training Devops Online Training
      Aws Online Training DataScience Online Training
      Hadoop Online Training


    6. Excelr is providing emerging & trending technology training, such as for data science, Machine learning, Artificial Intelligence, AWS, Tableau, Digital Marketing. Excelr is standing as a leader in providing quality training on top demanding technologies in 2019. Excelr`s versatile training is making a huge difference all across the globe. Enable ?business analytics? skills in you, and the trainers who were delivering training on these are industry stalwarts. Get certification on "
      aws training institute in hyderabad"
      and get trained with Excelr.

    7. Great Article. Thank you for sharing! Really an awesome post for every one.

      IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

    8. Thank you for excellent article.Great information for new guy like antimalware service executable

    9. Nice blog,I understood the topic very clearly,And want to study more like this.
      Data Scientist Course

    10. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!

      data science course

    11. Informative post, i love reading such posts. Read my posts here
      Laravel web development

    12. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
      AWS training in chennai | AWS training in anna nagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery

    13. Really impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing.

      Data Science Course

    14. This post is very simple to read and appreciate without leaving any details out. Great work!

      Data Science Training

    15. By reading this article, many things have piled up in my mind which made me to think about it.
      SAP training in Kolkata
      SAP course in kolkata
      SAP training institute in Kolkata

    16. This content is very considered and well-thought. You are a distinctive thinker. You have put up the unique points to bring up specific points.
      SAP training in Mumbai
      SAP course in Mumbai
      SAP training institute Mumbai