How can I use H2 database with laravel? - java

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

Related

How to write a SQL so that it can be run on any database

I have to write an application (in server 1) that will generate a SQL. The SQL will be transferred to some different server (server 2). Another application which is deployed on server 2 will run the query on a database deployed in server 2.
Now there can be different types of database and the query will not be a simple one (may be 200 lines of query). Is there any third party application (like Hibernate) which I can use to create the query may be in a different format (like HQL), which can be transferred to server 2 and the application on server 2 will convert it to a DB specific SQL and run it?
I am using Spring & Java 8 to write the application.
Thanks in advance.
It is not possible for native sql query. But If you use any ORM technology like Hibernate then it is possible. Hibernate dailect will generate different database specific query for you. Though hibernate is an ORM technology it will defines relations with Objects that will represent your database table's. Popularly we call that objects as Entity. SO If you want to use different database then there will be no problem. But you have to change dailelect for different databases.
Why not use ORM - JPA or Hibernate and move queries to configurable different XML which works for each platform/DB? Deploy the XML based on DB...
No shortcut here but if you use ANSI SQL standards which is a platform-independent and is used as a base with most Database systems including Microsoft SQL Server, Oracle, MySQL, IBM DB2 etc you queries should work almost without any issues. Obviously you will loose on added features of DB's provide.

from MySql database to embedded database?

i made a javafx application using MySql database , and now i want to use an embedded database.
whitch do you think is most similar to mysql , because i don't want to change too much in my program "queries".
You could use SQLite.
For basic SELECTs and most CRUD operations is the same as any SQL server-based engine.

Salesforce to java integration without API

i need to retrieve data from salesforce with java, but i would like to avoid use of API.
Is there any other way to get salesforce data from java application?
thanks to all
You have four primary options for integrating with Salesforce:
Use the REST API
Use the SOAP API
Use Heroku Connect to sync the data to a Heroku Postgres database
Use a third-party integration vendor that has support for Salesforce

How to switch (migrate) to Google Cloud SQL from DataStore?

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

google app engine Bigtable

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.

Categories