home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.sybase
- Path: sparky!uunet!news.centerline.com!noc.near.net!news.bbn.com!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!wupost!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sunic!seunet!enea!sommar
- From: sommar@enea.se (Erland Sommarskog)
- Subject: Re: How to connect APT-Form to different database?
- Message-ID: <1992Nov15.204137.20582@enea.se>
- Organization: Enea Data AB
- References: <EEDKSC.92Nov11123557@teamos50.ericom>
- Date: Sun, 15 Nov 1992 20:41:37 GMT
- Lines: 51
-
- Klaus Schniedergers (eedksc@teamos50.ericom) writes:
- >I have the following problem with the behated APT-Forms:
- > I want my form to be able to connect to different databases, i.e. defining
- >a database name in an environment variable then starting the form
- >without any recompiling or interactive input.
-
- Well, what exactly do you want to do? Do you want to run your
- application against different instances of the same database
- definition, or do you want to something more advanced? I am
- assuming that you want to do the former, since we have had this
- problem.
-
- >When creating the form, the database name is encoded in several places:
- >- the form-preprocessing-procedure (as ' sqlbegin use <db-name> sqlend ')
- >- the sql column connected to fields (<db-name>.dbo.table)
-
- First thing to do, is to remove all those 'use <db-name>' suckers and
- rely strictly on the default database. If you are running the application
- from your own startup program, the best idea is to look on the environ-
- ment variable and set the default DB before anyting else. If you are
- using aptexec, set the default DB in a surrounding script. Yes, this
- means that the same user cannot run two different databases at the
- same time, but that is what you get with such a corny concept as a
- default database.
-
- In our application, we use a slightly different approach. There is
- no environment variable, and the users cannot change the database
- on their own, but only the appointed super user can from a special
- menu. (They are not super users in the wide Unix sense, they are
- just as unexperienced of computers as the ordinary users, so neither
- they have shell access.)
-
- >A dirty solution would be running the <name>.frm file through an sed-script,
- >changing the database-name to the new one. But I would like a more
- >elegant solution.........
-
- Well, you don't need the shell script, Sybase has aptmig for you to
- do the task. But beware about the interface, which is very un-Unix.
- If you say "aptmig -n new_db *" you will cause a mess; you have to
- use find(1).
-
- However, as long as the databases are sufficiently identicial and
- accessible to everyone there is no need for migration. The only
- thing you have to make sure is that everyone is a user in the
- database to which the forms refer. If this is a security issue,
- make this an empty database.
-
- Yes, if the database are different this is a mess with hard-coded
- database names in the forms, but when did APT make anyone happy?
- --
- Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
-