How to Connect Multiple Database in Single App.
How can i Connect multiple databases using SQL adapter in IBM Worklight.. Scenario is Drop down which database selected that database has to connect in app.
In current releases of Worklight (5.x - 6.3), you cannot achieve this when using 1 adapter.
In order to connect to different databases your only option is to create several adapters.
Then, for each selected option from the dropdown, a different WL.Client.invokeProcedure code will be used to send a request (different adapter name).
This means you'll probably need to duplicate the adapter code as well... depending on your needs.
Related
I have a docker container with Oracle DB which I try to access from different clients with same credentials and its behaviour is quite strange.
I have set up connection in IDEA with following JDBC URL: jdbc:oracle:thin:#//localhost:1526/XEPDB1
Also I work with it via Spring Data framework in another container, url is jdbc:oracle:thin:#oracle:1521/XEPDB1 (port is forwarded to outer world as 1526, container name is oracle)
And finally, I tried to access the db using sqlplus from within db host: sqlplus LOGIN/PASSWORD#localhost:1521/XEPDB1
All connections are successful, but simple inserts and selects for same table show that each client sees only it's own modifications. What is wrong? How do I share same table between clients?
According to the connection strings, all the users are connected to the same database, so that isn't the issue.
The issue is probably that each user that modifies the data (e.g., inserts new rows), does so without committing, and thus this data is only available in their current session. Once they commit the data, it will be available to all the other sessions too.
I've started the HSQLDB server with two databases open. i'm using the server protocol for connection i.e.
jdbc:hsqldb:hsql://localhost/portdb
portdb is just one database, how can i tweak this URL such that it connects to this and the other db?
I've been referring to hsql user guide but seems nowhere defines this
You cannot open or connect to two databases with the same java.sql.Connection. Use two different connections, each with its URL.
You can have multiple schemas inside a database and access them with a single connection. See http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html
One way communication, from app to db is well apparent. Is there a way that my db also communicate back to app/ middle tier, or multiple instances of middle tier or apps.
Can triggers be used for this purpose in conventional rdbms (sql server/postgres)?
If you have a .NET based application, you can get notification back from SQL Server easily.
SQL Server service broker infrastructure, query notifications enables notification from database back to the application.
You can implement this in 3 ways.
1- Using SqlNotificationRequest class. Example
2- Using SqlDependency. Example
3- Using SqlCacheDependency Example
I've got 2 companies in different locations and the main server is at my office. The main server is working with a full version of SQL Server where the companies use SQL Server express version.
What is the best way to synchronize these SQL Server databases together that the main server have always the latest updates?
There are several technologies specifically for this type of scenario:
SQL Replication
Supports unidirectional or bidirectional synchronization
SSIS
Lets you define the mappings of the data, as well as transformations, and attach other code to the process easily
Linked-servers
Allows you to query databases and tables on remote servers as though they are part of the local database. Very easy to setup (just call exec sp_addlinkedserver) and once defined uses nothing but plain old SQL
If you want to do in an event (like button click), I would suggest Linked Server. Click here for a simple tutorial about how to create a linked server. After creating linked server, we can query it as follows:
select * from LinkedServerName.DatabaseName.SchemaName.TableName
I am looking for the best way to achieve the dynamic sync between server and clients. I have a central server and n-number of clients. I have designed a sync framework which will sync the data from and to between server and each client.
Here each client data is segregated by 2 filter columns. If I hard code these values for each client, then it will create one set of Sp' for each client (ex: selectchanges sp).
How can I achieve this dynamically? Please provide some sample code.
if by dynamic, you meant dynamic filtering, it's not supported.
however, if you're concern is having one selectchanges SP for each client, you can use Filter templates so all the clients share the same SP but use different parameter values.