I have doubt using jpa. I defined the datanucleus connection for MYSQL as follows.
datanucleus.ConnectionDriverName=com.mysql.jdbc.Driver
datanucleus.ConnectionURL=jdbc:mysql://localhost/myDB
datanucleus.ConnectionUserName=...
datanucleus.ConnectionPassword=..
My constraint is if I want to connect to google app engine datastore(ie Big table) via jpa
how to give the above connection for bigtable.
You don't need to configure any settings in order to persist to Bigtable using JPA - just run it inside the App Engine environment, and it ought to work fine.
Perhaps jiql would be useful.
Related
I am making a JavaFX application (rental management software) and using MySQL database,
I was wondering how can I make my application works on my friend or client's PC since the database is on my PC? Is there is any way to configure the database on their PC without them doing all the installation processes of MySQL because they are not good with PC and it's not reliable to make the client set up the database I want to use a local database?
Server versus embedded
There are two kinds of database engines:
Those that run in their own process, as a separate app, accepting connections coming from any number of other apps on the same computer or over a network. This we call a database server. Postgres, MySQL, Microsoft SQL Server, Oracle, etc run this way.
Those that run within the process of an app, being started and stopped from that parent app, accepting connections only from within that parent app. This we call an embedded database engine. SQLite runs this way.
Some database products can run in either fashion. H2 Database Engine is one such product.
Given your situation, and given that H2 is written in pure Java, I suggest replacing your use of MySQL with H2. Run H2 in embedded mode.
Cloud database
Another option is for you to set up a database (MySQL or other) available to your users over the internets. You can run your own server. Or you can utilize any of several Database-as-a-Service (DBaaS) vendors such as Digital Ocean. This “cloud database” approach may not be practical for desktop apps because of unreliable internet connections, security issues around database passwords, and the challenges of multi-tenancy.
Repository design
By the way, you may want to learn about the Repository design approach in using interfaces and implementations as a layer of abstraction between your app and your database. This makes switching out database engines easier.
For example, your repository interfaces would declare methods such as fetchAllCustomers() and fetchCustomerForId( UUID id ). One implementation of that interface might be built for MySQL while another implementation is built for H2. The code calling methods on your repository interface knows nothing about MySQL or H2.
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.
I am currently in a project and we need for some reason use h2 database. I would like to do an api in this project and I want to use laravel, because it is a framework I know to use. But I can't found information about connecting h2 database with laravel. Anyone knows how to do that? Is this even possible?
As per Laravel documentation:
Laravel makes interacting with databases extremely simple across a variety of database backends using either raw SQL, the fluent query builder, and the Eloquent ORM.
Currently, Laravel supports four databases:
MySQL 5.6+ (Version Policy)
PostgreSQL 9.4+ (Version Policy)
SQLite 3.8.8+
SQL Server 2017+ (Version Policy)
Reference:
Laravel -> Database -> Introduction
My goal is to achieve a bidirectional synchronization between a SQLite database on smartphone and a central MySQL database hosted on an Ubuntu server. I use the Codename One framework for the client side. Has someone already implemented a mechanism like this?
I have a Google App Engine Java application, which uses Appengine datastore for its persistence (Using JPA and Datanucleus).
Now I want to migrate my backend(database) to Google Cloud SQL.
I have already created cloud sql account and instance. I also granted permission for my GAE app to use this instance.
Now, how I can i rewrite my app or what are the changes I should make to my application, in order to migrate to cloud sql.
Any good tutorial is there for it?
Any help is greatly welcomed.
I would suggest following Using Google Cloud SQL with App Engine Java SDK. Once you've configured an example database, create new tables for the entities in your datastore.
For the actual data migration you have a few possible routes:
Download your datastore locally, manipulate the entries into SQL INSERT statements, and upload them to Cloud SQL
Write a script that reads through the datastore and writes rows to your SQL datastore (most likely using a task queue and datastore cursor)
Ignore the old data in your app and start from scratch