List of all dbserver names

Hi All,
In the servoy-admin page we can see all db server names along with its configuration details.

Is it possible to get all the db server names in a solution.
so that I can select any dbserver name and then according to selected db server name a value list of all table will be generate. and after selecting the table name , table records will display just like in crm ad hoc sql .

We can get the server names that are related to the solutions .
but I need to find out all db server names.

Thanks in advance

Not possible. You need a plugin to read the servoy properties on the server (easy to do).

Thanks Patric,
Plugin means…
I need to read the properties of server.

Can anyone suggest me what are the classes or related interfaces I need to use because there are number of classes and interfaces in the java servoy API

As the Servoy-admin page is showing all the db server names that implies
there is some class or interface is available.

Thanks Patrick again…

You need to create a client / server plugin (see Servoy’s mail plugin on how to do that). Then on the server side it’s easy. Just do something like this:

Properties props = server.getSettings();
// where server is an IServerAccess object
// then loop over the properties or call
// String propName = props.getProperty(“server.” + x + “.serverName”);
// where x is a counter starting from 0

Again Thanks Patrick…
Now I am clear what I have to do.
I will try to create that client-server plugin .

Also, I want to thanks all the members of this forum.

Hi Patrick and all,

In the following code I am always getting NullPointerException. can some one please point out where is the error

props = server.getSettings();
String propName = “”;
int length = props.size();
for(int i = 0 ; i < length ; i++) {
propName = props.getProperty(“server.” + i + “.serverName”);
}

where server is the object of ImplServerAccess class which implements IServerAccess

My aim is to get all the dbserver names

I suppose your server variable is null. You have to register a RMI service for your server plugin. Again, look at Servoy’s mail plugin to see how that is done. Especially, look at the initialize method.

Of course, you can also consider to ask someone to create a plugin for you. I could do that, for example :D.

Or you can just get the html of the server page and parse out the database connection names. I’m lazy that way :)

That might be faster :D

patrick:
That might be faster :D

For us, yes…but not necessarily for you!

With that piece of code you are looping through all properties.
I am sure you will see more null pointers than actual server connections.
You will have to code ‘cleaner’…

If a property is not found, it should not throw an exception, should it? So the loop should not be the problem. My guess is that the IServerAccess object is null, so it fails when actually getting the properties.

You are correct Patrick. Did not look further, though he was already trying to use the properties…

Anyway: let the pros do it, right? :lol: