Menu

HowToConnectJDBCDirect

Alberto Pereto

version 1.13.0 or higher

How to make Plandora to connect another Database?

The default mode of database connection is the connection pooling supplied by Tomcat. But, since version 1.13.0, a new mode was included to allow a JDBC direct connection. To change the connection mode it is necessary:

  • Stop Tomcat and edit the web.xml file of Tomcat.

  • The file contains a list of servlets defined in it. One of those, contains the initialization parameters described below.

  • The default behaviour is use a connection supplied by Tomcat through the URI jdbc/plandora, but if the "param-value" of parameter "data_source" is set to empty, the tool will try to open the connections using the parameters defined at "jdbc_driver", "jdbc_host" and so on.

  • After save the web.xml, start the Tomcat again.

    <!-- If the parameter below is defined, means that connection will be created from Tomcat connection pooling.
    In this case, the context.xml of Tomcat must be appropriately defined and the database library must be placed at TOMCAT lib folder (for example, mysql-connector-java-xxxx-bin.jar or hsqldb.jar, etc).
    For example: jdbc/plandora
    -->         
    <init-param>
        <param-name>data_source</param-name>
        <param-value></param-value>         
    </init-param>
    <!-- If the parameters below is defined (and the previous parameter 'data_source' is empty), means that connection will be created directly by PLANDORA using the JDBC definitions. In this case, check if the database library is placed at Plandora lib folder (for example, mysql-connector-java-xxxx-bin.jar or hsqldb.jar, etc) --> 
    <init-param>
       <param-name>jdbc_driver</param-name>
       <param-value>com.mysql.jdbc.Driver</param-value>         
    </init-param>
    <init-param>
       <param-name>jdbc_host</param-name>
       <param-value>jdbc:mysql://localhost:3306/plandora</param-value>          
    </init-param>
    <init-param>
       <param-name>jdbc_user</param-name>
       <param-value>root</param-value>          
    </init-param>
    <init-param>
       <param-name>jdbc_pass</param-name>
       <param-value></param-value>          
    </init-param>

Additional information

The default database used by Plandora is MySQL, and to make the Tomcat connection pooling works appropriately, it is necessary to put the MySQL library (see more about at http://dev.mysql.com/downloads/connector/j/) into Tomcat /lib folder. With the connection made directly, Plandora will use the own library placed at {Tomcat}\webapps\pandora\WEB-INF\lib.

Since version 1.13.0 Plandora brought at installation package, a zip file containing a list of SQL scripts with other databases (for example, Postgres and HSQL). It is important to notice that these scripts were released under beta version. The tests of Plandora were made using MySQL database.

To use another database (with or without connection pooling, it is mandatory to include the database library at Tomcat /lib folder or Plandora /lib folder depending on the mode choosen).


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.