Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a New Database in Oracle.
Message
From
28/02/2000 05:13:44
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00338152
Message ID:
00338311
Views:
12
This is achieved via the schema / tablespace concept.

What I do is create a tablespace (only to sepearte the two databases on different discs.
Then create 1 user on each tablespace to hold each database.
Then I create all the tables while logged in as each of the two users.

Now you would have two schemas / databases.

When I log in with my application I have the login screen with three fields.

User:
Password:
instance:

Then in my appliction I have a switch database function.
Which looks up in a local dbf file the owner and dblink to the database.
Or store the active database in an INI file.

Then all SQL statements have the following information appended:
normal select: select * from mytable
DB1
select * from DB1.mytable
DB2
select * from DB2.mytable

Remote Connection
select * from DB2.mytable@mydblink


Here is the function that gets the extra info:

FUNCTION GetTable

*used to get the full qualified path for the table
*eg.. sysadm.styles
*If using a remote connection sysadm.styles@pdm.dk
LPARAMETERS lctablename,lusequotes,cisseq

lnRecno=RECNO()
lnAlias=ALIAS()

IF PCOUNT()=1
lusequotes=.t.
cisseq=''
ENDIF

IF PCOUN()=2
**Contains the sequence part like 'seq.nextval'
cisseq=''
ENDIF

DO CASE
CASE gndbtype=1
**In special situations...Example: the procedure calls the data for STYLES will be used as default
lctablename=UPPER(ALLTRIM(lctablename))
select dbsetup
set order to tag dbname
seek lctablename
IF FOUND()
**OWNER.TABLE
lctablename=ALLTRIM(dbsetup.owner)+'.'+IIF(lusequotes,'"','')+lctablename+IIF(lusequotes,'"','')
IF dbsetup.instance!='PDM'
lctablename=lctablename+cisseq+'@'+ALLTRIM(dbsetup.instance)
ELSE
lctablename=lctablename+cisseq
ENDIF
ELSE
go top
seek 'STYLES'
**OWNER.TABLE
lctablename=ALLTRIM(dbsetup.owner)+'.'+IIF(lusequotes,'"','')+lctablename+IIF(lusequotes,'"','')
IF dbsetup.instance!='PDM'
lctablename=lctablename+cisseq+'@'+ALLTRIM(dbsetup.instance)
ELSE
lctablename=lctablename+cisseq
ENDIF

ENDIF
ENDCASE


IF USED(lnAlias)
SELECT (lnAlias)
LOCATE RECORD lnRecno
ENDIF

return lctablename


HTH!
Previous
Reply
Map
View

Click here to load this message in the networking platform