# database selection at startup

**URL:** <https://forum.servoy.com/t/database-selection-at-startup/1492>\
**Category:** Classic Servoy\
**Created:** [March 12, 2004, 8:06pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492 "2004-03-12T20:06:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [March 12, 2004, 8:06pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/1 "2004-03-12T20:06:10Z")

</div>

my client needs the ability to connect to one of two (identical)  
databases when the servoy application starts up.

in one case, the user is in the home office, on his/her  
laptop, connected via lan to the company server. the  
solution file will be stored on the laptop, along with a  
copy of servoy.

in the second case, the user is out of the office (using the same laptop),  
and will run the same servoy solution, but needs to  
connect with an exact replicla of the company database  
that is stored on the laptop.

how can i have servoy connect to one server or the other,  
under program control, at startup time, without the user  
having to go into Preferences/DB Servers and changing  
the Database Server URL manually?

it would be ok with the client to put up a dialog at startup,  
asking the user if this is a “remote” or “local” connection,  
but i can’t figure out how to switch between databases,  
since they seem to be “hardwired” from the design area.

this is very important to the client; without this capability,  
the project will probably not continue.

help (please!)  
rm.

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [March 14, 2004, 6:51pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/2 "2004-03-14T18:51:09Z")

</div>

…as an alternative to what i’m trying to do in my last post,  
i could possibly export records from one database, and  
import them into the other (remote or “offline”) database.

the tricky part with this method is, i can’t find any way to  
import & export records under program control; only by  
using the import & export menu items under the file menu.  
this is unacceptable, as we don’t want our users to be  
responsible for importing & exporting records.

so the next question is: can i export & import records  
under control of a script?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [March 14, 2004, 8:27pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/3 "2004-03-14T20:27:40Z")

</div>

first of all.  
clients don’t have database connections.. The server does.  
So what do you mean with:

> without the user having to go into Preferences/DB Servers and changing  
> the Database Server URL manually

because a client can’t go to that specific preference tab… (it doesn’t have that tab)

The solution you could do now if you can synchronize the database yourself at this moment. That the laptop connects to the office server when he is at the office, (starts a client from the office server)  
And if he is at home, he starts a client that connects to itself. But then you need to install a server on the laptop itself.. And that one does connect to the database on the laptop..

We do have a real offline client on the planning and also scripting import/export is on the planning right after 2.0.

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [March 15, 2004, 11:40pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/4 "2004-03-15T23:40:18Z")

</div>

> jcompagner:  
> That the laptop connects to the office server when he is at the office, (starts a client from the office server)  
> And if he is at home, he starts a client that connects to itself. But then you need to install a server on the laptop itself.. And that one does connect to the database on the laptop..

ah! perhaps that’s the answer…hmmm.  
i’ll have to think this through.

> We do have a real offline client on the planning and also scripting import/export is on the planning right after 2.0.

excellent! when will 2.0 be released?

also, i could solve my problem if i could create text files  
on the user’s hard drive and just write out the information  
i need…but i can’t find a way to create a file and write (or  
read) from it. can this be done?

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [March 16, 2004, 12:58pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/5 "2004-03-16T12:58:45Z")

</div>

Yes, this can be done. You have application.readTXTFile, readFile, writeFile and writeTXTFile for this.

Veeeeeeeeeeeeeery powerfull…

you can use this in combination with, for example, createTempFile and the file plugin to set and get all kinds of attributes, folders etc…

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [March 17, 2004, 4:23pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/6 "2004-03-17T16:23:43Z")

</div>

> IT2BE:  
> Yes, this can be done. You have application.readTXTFile, readFile, writeFile and writeTXTFile for this.

marcel, thank you very much for your reply. this is what  
i need to do to make everything work for my client.

on another note, i’m somewhat disappointed by the lack  
of response from the servoy developers; it’s been two  
days since i posted that question. as a registered user  
of servoy, i expect (and need) to get responses more  
rapidly.

this has happend several times in the past as well.

we’re still not sure if servoy has the capabilities to do  
what we need it to do, and if it does not, we’ll need  
to choose another product (or code the whole thing  
in a regular programming language).

is there another avenue for registered user to get  
support issuses resolved quickly?

rm.

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [March 17, 2004, 5:15pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/7 "2004-03-17T17:15:28Z")

</div>

Robert, I understand your disappointment but I can’t say anything but ‘Servoy gives great support’.

We have to respect the fact, imho, that Servoy developers should do what they are best in. Develop Servoy further into the sky…

I can imagine that with the increasing number of experienced users responce times will go up.

As for your question concerning ‘is Servoy the right tool for the job’. Just ask… I (and am sure others with me) will try to help you to make your decision. As always some things will be suitable and some will not.

If you want/need faster responce I think there is a clause in the SAN memebership giving you priority support on certain issues.

A training is an option too (you could get a training from me if you want)…

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [March 17, 2004, 8:57pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/8 "2004-03-17T20:57:57Z")

</div>

> RobertMeyer:  
> on another note, i’m somewhat disappointed by the lack  
> of response from the servoy developers; it’s been two  
> days since i posted that question. as a registered user  
> of servoy, i expect (and need) to get responses more  
> rapidly.

Our average response time to questions is well below 4 hours. And that for unpaid forum support. If you have purchased support (part of the subscription license), you can also contact [support@servoy.com](mailto:support@servoy.com) for faster response.

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [March 17, 2004, 10:00pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/9 "2004-03-17T22:00:24Z")

</div>

> jaleman:
> 
> > RobertMeyer:  
> > on another note, i’m somewhat disappointed by the lack  
> > of response from the servoy developers; it’s been two  
> > days since i posted that question. as a registered user  
> > of servoy, i expect (and need) to get responses more  
> > rapidly.
> 
> Our average response time to questions is well below 4 hours. And that for unpaid forum support. If you have purchased support (part of the subscription license), you can also contact [support@servoy.com](mailto:support@servoy.com) for faster response.

i was not aware of that. we have purchased servoy, and i’ll  
use that mechanism from now on. thank you.

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [March 17, 2004, 10:35pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/10 "2004-03-17T22:35:53Z")

</div>

At this moment having two servoy.properties files (one pointing to your local server one to office server) would be the easiest (rename the file, you could script that). Our offline edition scheduled for this summer will make working in multiple locations automatic.

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [March 18, 2004, 3:09pm UTC](https://forum.servoy.com/t/database-selection-at-startup/1492/11 "2004-03-18T15:09:41Z")

</div>

that sounds like a great way to solve the problem.

thanks.
