Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple databases #554

Closed
kdhrubo opened this issue May 10, 2024 Discussed in #458 · 0 comments
Closed

Add support for multiple databases #554

kdhrubo opened this issue May 10, 2024 Discussed in #458 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kdhrubo
Copy link
Collaborator

kdhrubo commented May 10, 2024

Discussed in #458

Originally posted by MichalisDBA April 12, 2024
Hello.

I do not know if you have this on the roadmap. I'll just give you my idea on how i envision to work with multiple data sources running a single instance of db2rest.

Create a config file. Let's say datasources.conf

Inside this configuration file have the following settings:

db2rest:
	SERVER_PORT: 8090

java:
	-Xms2048m
	-Xmx8192m

db1:
	service:
		DRIVER: ORACLE
		USERNAME: USER
		PASSWORD: PASS
		SERVER: IP / FQDN
		INSTANCE: MY_INSTANCE
		SCHEMA: MY_SCHEMA #optional
		TABLES: [TABLE1, TABLE2] #optional
	env:
		ENABLE_DATETIME_FORMATTING: true
		TIME_FORMAT: HH:mm:ss
		DATE_FORMAT: dd-MM-yyyy
		DATE_TIME_FORMAT: "dd-MM-yyyy HH:mm:ss"
	jdbc:
		oracle.jdbc.timezoneAsRegion: false

db2:
	service:
		DRIVER: MYSQL
		USERNAME: USER
		PASSWORD: PASS
		SERVER: IP / FQDN
		DATABASE: MY_DATABASE
		TABLES: [TABLE1, TABLE2] #optional
	env:
		ENABLE_DATETIME_FORMATTING: true
		TIME_FORMAT: HH:mm:ss
		DATE_FORMAT: dd-MM-yyyy
		DATE_TIME_FORMAT: "dd-MM-yyyy HH:mm:ss"
	jdbc:
		oracle.jdbc.timezoneAsRegion: false

Then you can run db2rest like that:

java --config=datasources.conf -jar db2rest.jar

When the application starts you can query the different data sources like that

http://localhost:8090/db1/my_table/?

http://localhost:8090/db2/my_view/?

Something like that.

@kdhrubo kdhrubo self-assigned this May 10, 2024
@kdhrubo kdhrubo added the enhancement New feature or request label May 10, 2024
@kdhrubo kdhrubo added this to the May2024 milestone May 10, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
kdhrubo pushed a commit that referenced this issue May 11, 2024
@kdhrubo kdhrubo closed this as completed May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant