B4J Question jRDC2 Dynamic Config selection

marconotsopolo

Member
Licensed User
Hi All

This is my first post so please be gentle :) and I am still pretty new to B4J but have already learnt a great deal from this fantastic community.

It looks like it is not possible but thought I would put it out there anyway to see if anyone has thought of or created an alternative solution.

I am using jRDC2 to connect to my cloud MS SQL database from my B4A app, and I want to tell the server to use a specific database using the rdclink when the app makes a connection, so I had a thought that if in the rdclink string I include say /A3001 instead of rdc (that being the possible account number and relative DB name) and add a handler in RDCHandler to capture this and then read a list from a data file with all the account numbers mapped to the relevant DB and name the config file the same as the account name this would then open the relevant config.properties file.

However rdcConnector initialises and reads the config file before the handlers get initiated, so that theory went out the window.

I looked at the following but this is for opening 2 databases (or more) from the rdcconnector.initialise
https://www.b4x.com/android/forum/threads/jrdc-how-to-connect-to-multiple-database.59930/#content

Is this even possible with jRDC or am I barking up the wrong tree??

Thanks
Mark
 

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

marconotsopolo

Member
Licensed User
The thread you posted is about jRDC!

Edit to add: i now see your jrdc2 in the threadtitle. I guess it should work with jrdc2 too if that is the question.

Hi

Thanks for the reply, the question was about whether you could change the config file based on the rdc request from the client??

Thanks
Mark
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
You can do this without modifying the config... For MS SQL you can write

B4X:
Use databaseName

So it can be saved to the right database. You will have to modify quite a bit jrdc
 
Upvote 0

marconotsopolo

Member
Licensed User
You can configure the rdc to reload the config file on every request. As far as i know you can not change it.
You maybe should setup a http rest server where you can do whatever you want.
Ok, you have to use json for the transport or such.

Hi

Thank you I will take a look into that as an alternative option

Regards
Mark
 
Upvote 0

marconotsopolo

Member
Licensed User
You can do this without modifying the config... For MS SQL you can write

B4X:
Use databaseName

So it can be saved to the right database. You will have to modify quite a bit jrdc

Hi

Could you explain a little more, as I thought that the config properties maintains the link to the database, therefore this tied you to one database from that config file? and without creating multiple rdcconnectors to load multiple config files then this would always be a constant?.

Thanks
Mark
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
In jrdc2 you can specify the database but that is optional for ms SQL.

If you modify jrdc to receive the database along with the rest of the information. You will be able to store it in the correct database
 
Upvote 0

marconotsopolo

Member
Licensed User
In jrdc2 you can specify the database but that is optional for ms SQL.

If you modify jrdc to receive the database along with the rest of the information. You will be able to store it in the correct database

Hi

Thanks for your time, so are you saying then that I can remove the database name from the jdbcUrl?

I can add the extra parameters in jRDC to return a value from the app and pick this up in the POST get and modify the handle sub no problem, just trying to get my head around how this works.

I will give it a go and see how I get on, thanks again though for the input

Regards
Mark
 
Last edited:
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Hi

Thanks for your time, so are you saying then that I can remove the database name from the jdbcUrl?

I can add the extra parameters in jRDC to return a value from the app and pick this up in the POST get and modify the handle sub no problem, just trying to get my head around how this works.

I will give it a go and see how I get on, thanks again though for the input

Regards
Mark
Yes correct!!
 
Upvote 0
Top