PreviousNext
Help > Programming with LAUNCHER Office > Java classes > Use examples > 13) LNCPRTDOC : PostgreSQL
13) LNCPRTDOC : PostgreSQL

In this example, the database has the following characteristics :

         Type DB : PostgreSQL

         Database server address  : 192.168.1.7

         Port number of the database server : 6078

         Database user : postgres

         Database user password : aura

         Database name : newold

         SQL query : select * from marci where title < 'b'

The command LNCPRTDOC is used to generate the following Word document:

C:\temp\TEST4_POSTGRESQL.doc

 

The template used for mail merging is :
C:\temp\SP_CUST_POSTGRESQL.DOC

     String template = "C:\\temp\\SP_CUST_POSTGRESQL.DOC";
     String destination = "C:\\temp\\TEST4_POSTGRESQL.DOC";

     DataSource myDataSource = new DataSource();
     myDataSource.setType("postgresql");
     myDataSource.setSrvAddr("192.168.1.7");
     myDataSource.setPort("6078");
     myDataSource.setUser("postgres");
     myDataSource.setPassword("aura");
     myDataSource.setDBName("newold");
     myDataSource.setQuery("select * from marci where title < 'b'");

     LNCPRTDOC myLNCPRTDOC = new LNCPRTDOC();
     myLNCPRTDOC.setDoc(template);
     myLNCPRTDOC.setSavFmt("*NORMAL");
     myLNCPRTDOC.setShowDoc("true");
     myLNCPRTDOC.setMrgType("*FILE");
     myLNCPRTDOC.setUnlink("true");
     myLNCPRTDOC.setOutSave("true");
     myLNCPRTDOC.setSavDoc(destination);
     myLNCPRTDOC.setMrgSel("*LTR");
     myLNCPRTDOC.setExecMrg("true");
     myLNCPRTDOC.setEndOpt("*NONE");
     myLNCPRTDOC.setHeaderSrc("*FILE");
     myLNCPRTDOC.setSourceData(myDataSource);
     myLNCPRTDOC.setDltLgn("true");
     myLNCPRTDOC.setSourceData(myDataSource);
     myLNCPRTDOC.setLNCSrvAddr("192.168.1.9");

     myLNCPRTDOC.execute();