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 

    Vertica
    com.vertica.jdbc.Driver
    jdbc:vertica://<server>:<port>/<database>
    5433   

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() {
super();
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" 
    -Dnext.dialect.class_1="mypackage.VerticaDialect"

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

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

    105 comments:

    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 Dialect.java 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 Dialect.java 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.

      ReplyDelete
    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?

      ReplyDelete
    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

      ReplyDelete
    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

      ReplyDelete
    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

      ReplyDelete

    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.

      ReplyDelete
    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

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

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

      ReplyDelete
    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

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

      ReplyDelete
    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

      ReplyDelete
    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

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

      Data Science Training

      ReplyDelete
    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

      ReplyDelete
    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

      ReplyDelete
    17. This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job!
      PMP Certification Training in Bangalore

      ReplyDelete
    18. I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more.
      data science institute in hyderabad
      data analytics course
      business analytics course

      ReplyDelete
    19. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful.
      data science course
      data analytics course
      business analytics course in hyderabad

      ReplyDelete


    20. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
      360DigiTMG business analytics course
      360DigiTMG data analytics course
      360DigiTMG data science course

      ReplyDelete
    21. I curious more interest in some of them hope you will give more information on this topics in your next articles.
      360digiTMG data scientist course


      ReplyDelete
    22. I have gone through your article and I have found that all the points are unique and imaginative in my opinion. Hope to read some more like this article.

      SEO services in Kolkata
      SEO company in Kolkata
      SEO in Kolkata
      Best SEO services in Kolkata
      Best SEO company in Kolkata

      ReplyDelete
    23. I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article.

      Simple Linear Regression

      Correlation vs Covariance

      ReplyDelete
    24. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
      Correlation vs Covariance
      Simple linear regression
      data science interview questions

      ReplyDelete
    25. I have truthfully never come across such overwhelmingly good piece of content. I agree with your valid points and your ideas. This piece of information is really great.
      Thank you so much.
      SAP training in Kolkata
      SAP course in kolkata

      ReplyDelete
    26. I'm not among those readers that comments on every article often after reading it, but yours really bound me. I have come across a lot of interesting piece of information in this article that is bold.
      SAP training in Mumbai
      SAP course in Mumbai

      ReplyDelete

    27. This is the information that I have been looking for. Great insights & you have explained it really well
      data science course


      ReplyDelete
    28. The content that I normally go through nowadays is not at all in parallel to what you have written. It has concurrently raised many questions that most readers have not yet considered.

      SAP training in Kolkata
      SAP training Kolkata
      Best SAP training in Kolkata
      SAP course in Kolkata

      ReplyDelete
    29. You have provided finicky information for a new blogger so it has turned out to be really obliging. Keep up the good work!
      Data Science training in Mumbai
      Data Science course in Mumbai
      SAP training in Mumbai

      ReplyDelete
    30. Great blog, thanks for sharing this information.

      ReplyDelete
    31. asp net development company has the propelled aspect of Micro's.Net structure and it is viewed as the best application system for building dynamic dot net development services and dot net company. Subsequently the cutting edge asp.net advancement organizations that have dynamic website specialists and online application engineers profoundly depend on this. The accompanying focuses made ASP .Net a default decision for everybody. dot net development company (articulated speck net) is a system that gives a programming rules that can be utilized to build up a wide scope of uses – from web to portable to Windows-based applications. The .NET system can work with a few programming dialects, for example, C#, VB.NET, C++ and F#. At Grand Circus, we use C#.

      ReplyDelete
    32. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
      360digitmg

      ReplyDelete
    33. Truly overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. Much obliged for sharing.business analytics course

      ReplyDelete
    34. All things considered I read it yesterday however I had a few considerations about it and today I needed to peruse it again on the grounds that it is very elegantly composed.
      data scientist training

      ReplyDelete
    35. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
      iot course training in Hyderabad

      ReplyDelete
    36. Incredibly all around intriguing post. I was searching for such a data and completely appreciated inspecting this one. Continue posting. A commitment of gratefulness is all together for sharing.data science course in Hyderabad

      ReplyDelete
    37. Thanks for sharing the valuable information. it’s really helpful.Best data science courses in hyerabad

      ReplyDelete
    38. I truly like your style of blogging. I added it to my preferred's blog webpage list and will return soon…
      https://360digitmg.com/course/certification-program-in-data-science

      ReplyDelete
    39. good information seeking more such blogs in future.
      https://360digitmg.com/course/machine-learning-using-python-r

      ReplyDelete
    40. thanks for the information seeks such more blogs with complete knowledge.
      360DigiTMG data analytics course

      ReplyDelete
    41. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
      data science courses

      ReplyDelete
    42. This comment has been removed by the author.

      ReplyDelete
    43. Such a very useful information!Thanks for sharing this useful information with us. Really great effort.
      data science course delhi

      ReplyDelete
    44. Your work ethic is out of this world! The pride you take in your work is truly inspiring.
      360DigiTMG big data course malaysia

      ReplyDelete
    45. This post is very simple to read and appreciate without leaving any details out. Great work!
      data science course in delhi

      ReplyDelete
    46. I see some amazingly important and kept up to length of your strength searching for in your on the site
      Best Institute for Data Science in Hyderabad

      ReplyDelete
    47. It’s really admirable how you always see projects through from conception to completion.
      https://360digitmg.com/course/data-analytics-using-python-r

      ReplyDelete
    48. It’s amazing how you always help new strategies get up to speed.
      360DigiTMG data analytics course

      ReplyDelete
    49. I find your opinion quite interesting, but the other day I stumbled upon a completely different advice from another blogger, I need to think that one through, thanks for posting.
      360DigiTMG courses on data analytics

      ReplyDelete
    50. Nice and very informative blog, glad to learn something through you.
      data science certification malaysia

      ReplyDelete
    51. Very informative content and intresting blog post.Data science course in Nashik

      ReplyDelete
    52. Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.
      Data Science Course in Bangalore

      ReplyDelete
    53. This is one of the best content for this topic and this is very useful for me. Thank you!
      Unix Training in Chennai
      Unix Course in Chennai
      Linux Course in Chennai

      ReplyDelete
    54. Thanks for posting the best information and the blog is very informative.Data science course in Faridabad

      ReplyDelete
    55. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
      Data Science Training in Bangalore

      ReplyDelete
    56. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
      data analytics course in bangalore

      ReplyDelete
    57. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
      artificial intelligence course in pune

      ReplyDelete
    58. Thanks for posting the best information and the blog is very informative.Data science course in Faridabad

      ReplyDelete
    59. wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmarked your site and also added rss. keep us updated.
      business analytics course

      ReplyDelete
    60. I am a new user of this site, so here I saw several articles and posts published on this site, I am more interested in some of them, hope you will provide more information on these topics in your next articles.
      data analytics training in bangalore

      ReplyDelete
    61. Thanks for posting the best information and the blog is very informative.Data science course in Faridabad

      ReplyDelete
    62. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
      artificial intelligence course in pune

      ReplyDelete
    63. I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation. Thanks a lot for keeping great stuff. I am very much thankful for this site.
      data scientist certification

      ReplyDelete
    64. Highly appreciable regarding the uniqueness of the content. This perhaps makes the readers feels excited to get stick to the subject. Certainly, the learners would thank the blogger to come up with the innovative content which keeps the readers to be up to date to stand by the competition. Once again nice blog keep it up and keep sharing the content as always.
      Data Science Training

      ReplyDelete
    65. I want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging enedevors.
      data science course bangalore

      ReplyDelete
    66. Thanks for posting the best information and the blog is very helpful.Data science course in Varanasi

      ReplyDelete
    67. I Want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging endeavors.
      cyber security course in bangalore

      ReplyDelete
    68. Thanks for posting the best information and the blog is very important.data science interview questions and answers

      ReplyDelete
    69. Thanks for posting the best information and the blog is very helpful.Data science course in Varanasi

      ReplyDelete