tomcatderbyjavadb

How do I install derby on my Debian Sever to connect with Tomcat?


On my development machine with Windows, I am using Netbeans to develop a JSP application, so creation of the DB was straightforward with Netbeans. I installed TOmcat on my server with only ssh access, how do i then install Derby as a database and make Tomcat use it ?


Solution

  • Derby does not, strictly speaking, get "installed as a database" in the way that other database engines do, because it is primarily designed to be deployed as an embedded database inside your application.

    But you can choose whether to deploy Derby as an embedded database engine, or as a separate server.

    If you deploy Derby as an embedded engine, then the only server operating on your system is Tomcat, and your web application packaging should include the appropriate Derby engine jar files. Your JDBC Connection URL will use the embedded engine format.

    If you deploy Derby as a server, then you will need to separately start and stop Derby apart from starting and stopping Tomcat. You will need to make a few configuration choices, such as what port number the Derby server should use for accepting connections, and where the database data should be stored. Your JDBC Connection URL will use the client-server engine format, and your web application packaging should include the appropriate Derby client jars, but not the entire Derby engine jars.

    Deploying Derby as a server enables more flexible application deployments (for example, two different applications can both share the same server, and the application client can be on a separate machine than the Derby server, etc.).

    However, deploying Derby as a server introduces additional complexity (more moving parts) into your overall software system, and also means that you have another server to secure, operate, and backup.

    No matter what, please make sure that you think about security and backup/restore early in the development of your application. After deployment is the wrong time to start thinking about these operational considerations!

    You can find lots of additional information in the Derby documentation. A great place to start is here: https://db.apache.org/derby/docs/10.15/devguide/cdevdeploy38918.html