AWS CDK: Is there a way to create database schema using CDK? - java

I have created a RDS Aurora Postgres Database Cluster and Database Instance through CDK (using java as a language). Now I am trying to achieve creating a database schema through CDK. I tried but did not find any documentation or help anywhere which tells
If at all it is possible to create DB schema through CDK for RDS databases?
If so, how?
If not, what are the best practices for this to achieve?
If anyone has already done it or has knowledge, I will appreciate pointing me to right direction.
Thanks,
Horizon7

The CDK itself does not have an out of the box solution for creating SQL schemas as it is used for managing the provisioning of infrastructure.
However, there is a tool for creating additional processes, this tool is a CustomResource.
A CustomResource will allow you to invoke a Lambda function, this function could be developed to perform SQL interaction with the RDS instance and then create the schemas.
If you enable RDS Proxy your Lambda function should be able to interact with the RDS instance without any additional considerations for networking. As long as it has the IAM permissions it can invoke the commands.

Related

Fields retrieved by the REST API do not correspond to fields in the object manager

I need all the data backup storage on a regular basis on Salesforce to local database, so I wrote a program that calls the REST API /services/data/v53.0/sobjects access to all the sobjects, Then respectively according to their name call /services/data/v53.0 sobjects/XXX/describegot fields for each object, but I found that the fields I got did not match the fields in the object manager.
I've also tried using SOQL directly:
SELECT EntityDefinition.QualifiedApiName, QualifiedApiName, DataType
FROM FieldDefinition
WHERE EntityDefinition.QualifiedApiName = 'xxx'
But it still doesn't work, if I need to back up the CRM data to my own local database, what do I need to do? How do I get all the tables and all the fields and export them?
please help me!
There are a few ways to do this, but none of them are easy. In the past I have used addons that connect directly to Salesforce via MSSQL. One such application is purpose built for this use case. Its called DBamp. Unfortunately it is rather pricy. You can also connect to your Salesforce instance with integration software like Jitterbit, Mulesoft, DellBoomi or Talend. That approach would require creating an integration catered to the object you want the backup for.
On free side, you could use Excel to connect to your Salesforce instance and pull down whatever object you want, this is probably not an ideal solution though. Data Tab > Get Data > From Online Service > From Salesforce Object.
enter image description here
I have seen other solution like creating full copy sandboxes every week. The last option is connecting MSSQL to Salesforce via SSIS and an ODBC connector but this has been a pretty bad experience in the past, could just be me though.

Spring Boot: Is it possible to have an h2console connect directly to a MySQL DB?

I am intending to have a console on my web app so I can run queries directly from my browser. I can only find guides on how to connect the h2console to an in-memory DB instance. Is this possible? Security isn't an issue, this is strictly for testing purposes, only my ip address will be allowed to connect to the site (for now).
I think you are confusing some things here: h2 is an in-memory-database. There is NO persistent storage. MySQL is a proper RDBMS. I would not expect you to be able to connect to mysql through that interface.
If you just need to be able to execute queries from your web application, and it is not going to go public, simply create a page with a textarea, send that to the backend using JDBC. If I have misunderstood your question, please add additional details to it so we cn provide a better answer.

How to access MySQL database in jBoss BPM suite process

I am newbie in JBoss BPM Suite. What i want to achieve, is to access my MySQL database through a business process. I have already added a datasource to my application server including the jdbc driver. What i tried to do was to connect to my db by a script task. Although i got an exception ClassNameNotFound for my driver class 'com.mysql.jdbc.Driver'. What is the right way to connect to the db? Is there a way to do this by a service task? Or a WorkItemHandler?
Thanks in advance.
It is not recommended to execute any complicated logic (like accessing the database) in a script task. I would also assume that your application server does not put database drivers on the classpath of its applications since it is against the whole idea of datasources. You just need to make use of the datasource you have already configured.
When it comes to the right way how to connect to the database inside your process, you will need to implement your own work item handler where you can get your data from the database. There are many different ways how you can achieve this. You can find inspiration from JPAWorkItemHandler which will be available in version 7.
I have finally made the connection to my database by creating a WorkItemHandler and add it as a dependency to my BPM Suite project. After a lot of search, i think this is the best way to do it if anyone wants to access his database in a business process.

Working with a cloud app and local private database

We are developing a cloud ERP product using java and want to provide the users to have an option to work either with a local database file or the database on the cloud. To some of our customers, their data is very sensitive and they do not want their data stored on web server, instead want to have the database on their own server/pc.
Will this kind of offering be technically viable, secure & effective to implement and maintain? If so, can anyone recommend the best work around for this kind of architecture where the application on our cloud server can work seamlessly with the local database?
Many Thanks
LJ
For your customers concerned with security, maybe using a local datastore such as MySQL running on a local server and a local instance of the ERP product, also running on a local server. And I would advise encrypting all sensitive columns using something like AES_ENCRYPT() -- even on this local database.
Otherwise I don't know of a way to run a hosted App with a secured local database without introducing all kinds of data vulnerabilities.

PostgreSQL application access

I'm using JDBC to connect to a PostgreSQL database. We are trying to block access to the database for the users themselves; instead they should be forced to use our frontend. We blocked access to any table, and gave only procedures, which do all the work for users, still not giving them any opportunity to access data directly. We tried to block access to schema pg_catalog, which limits users to procedures we created, but it seems that this access is needed for JDBC to call any procedure.
Anyway, the question is either how to use JDBC without access to pg_catalog, or how to authorize only connections made by application, not user.
There is no fool proof way but the simplest is to use a username and password for the connection that you do not give to your users. Store the password in an encrypted configuration file. Ofcourse the encryption key can be retrieved from the application by a smart person.
For a really save system it would probably be best to put a service in front of the database that handles all security and provides a high level API to access the data and let the client connect to this.
The DBMS is being presented with a Catch-22 situation:
When a user runs a specific JDBC program to access the database, let it do its stuff.
When a user runs any other JDBC program to access the database, do not let it do its stuff.
How can the DBMS tell the difference between the two programs? As far as it is concerned, they are both clients that are using the correct protocol to communicate with the DBMS, and have identified themselves as a legitimate user of the database.
To make it work, you have to find a non-subvertible way to distinguish between the two applications. That is not trivial - to say the least.
There are kludges, but there isn't a clean solution. It is a generic problem that any DBMS faces when the problem is presented as in the question.
Well, just don't give your users an account on your postgresql database and create only an postgresql account for your application.

Categories