What is the correct way to connect to a database from an eclipse plugin? - eclipse-plugin

I am evaluating the Rich Ajax Platform (RAP) and I need to connect to a DB2 database (and perhaps others).
Having done a fair amount of J2EE work I usually fetch a DataStore object via JNDI and use that to connect to a database. The actual connection parameters are configured outside of the application and can be adapted for development, test and production environments.
-- How should I go about this from within a plugin in RAP?
-- What is the best way to handle connections in different enviroments?
-- I also don't want to include the DB2 JDBC jars in the plugin as they may differ slightly between development and production.

Check this: http://www.eclipse.org/datatools

Related

Is it possible to share datasource testcontainer between quarkus apps in dev mode?

For kafka, redis and other testcontainer services there is a quarkus.*.devservices.shared configuration option (e.g. https://quarkus.io/guides/dev-services#quarkus-kafka-client-config-group-kafka-dev-services-build-time-config_quarkus.kafka.devservices.shared), which will reuse testcontainers of that type if there is already an existing one running.
Is there a way to achieve something similar with datasources/dbs?
Example:
I have two quarkus apps and I want to share a mysql db between them in dev mode. Setting up the tables is done with flyway.

How to build a development and production environment in apache nifi

I have 2 apache nifi servers that are development and production hosted on AWS, currently the migration between development and production is done manually. I would like to know if it is possible to automate this process and ensure that people do not develop in production?
I thought about uploading the entire nifi in github and having it deploy the new nifi on the production server, but I don't know if that would be correct to do.
One option is to use NiFi registry, store the flows in the registry and share the registry between Development and Production environments. You can then promote the latest version of the flow from dev to prod.
As you say, another option is to potentially use Git to share the flow.xml.gz between environments and using a deploy script. The flow.xml.gz stores the data flow configuration/canvas. You can use parameterized flows (https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#Parameters) to point NiFi at different external dev/prod services (eg. NiFi dev processor uses a dev database URL, NiFi prod points to prod database URL).
One more option is to export all or part of the NiFi flow as a template, and upload the template to your production NiFi, however registry is probably a better way of handling this. More info on templates here: https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#templates.
I believe the original design plan behind NiFi was not necessarily to have different environments, and to allow live changes in production. I guess you would build your initial data flow using some test data in production and then once it's ready start the live data flow. But I think it's reasonable to want to have separate environments.

database connection in GeoServer

I am going to use redis as the web cache for geoserver, so I need to understand the database connection in geoserver. I have imported geoserver in Eclipse, and there are two projects named gs-sec-jdbc and gs-web-sec-jdbc. I do not know what the “sec" means and what are the differences between these two projects. Any help or tutorial is appreciated! Thank you !
These two modules are part of the security subsystem (gs-web-sec-jdbc is the web based user interface). They are almost certainly not the modules you are looking for.
If you intend to use redis to store WMS output images then you need to look at how GeoWebCache works.
If you want to provide a cache between GeoServer and a JDBC database then you will need to explore GeoTools' JDBC datastore mechanism.

multiple clients silmuntaneously on sesame repository

i use sesame for a project and i use a local nativestore file repository. everything is fine but when multiple clients use my application silmuntaneusly the repository locks.How can i deal with parallel connections problem;
A Sesame Native Store assumes it has sole, unique access to its datadir. This means that you can not create two NativeStore objects that use the same datadir, as this will cause inconsistencies and potential deadlocks. So, you need to share a single NativeStore object.
In a single JRE, this can be easily achieved by using a RepositoryManager. See this article for an explanation and code examples. If your setup requires several independent client applications to connect to Sesame, you will either have to implement your own server app for these clients to connect to, or you can use a Sesame Server and have each client connect via a HTTPRepository.

GlassFish multiple EARs

I have an EAR that I deploy as production, in context "/".
I'd like to deploy a test version of the application on the server, the same Glassfish instance.
Is it possible to deploy the application under a different context and port in the same instance?
If so, beside changing the context in application.xml, do I need to change anything else?
Usually you can deploy a test version of the application by altering the context root, and deploying it as a whole new application.
However, you must take the application's design into consideration. If the application utilizes a database, more often that not, you'll need a test database instance. All JNDI names (this includes datasources and EJBs, if any) that the test and production applications use, must not have any conflicts. It is an ill-advised move to run multiple instances of the same application, all of which reference the same JNDI names.
Finally, it is a standard accepted practice to separate your test and production environments, and even have separate machines for the same, in the case of mission critical apps and the like. This is done usually to prevent accidental overwriting of one environment (usually the production one) by another.