UNION on two views in Different databases
Hi All,
Could you please help me in sorting out this requirement.
We have two views in one database and two more views in another database. Now I want to create one view which should give the union of all these four views. We have DB links. Is it possible? If yes please send me the script.
Thanks in advance to all.
Thanks & Regards
Rajesh Amathi
Hi and welcome to OTN.
please refer to Oracle books, your question is simple and also a few hard explained.
You can use union, union all, intersec and of course many join methods. Which one is for you, you should decide it, or let us know what exactly do you need.
If objects separated different databases, of course db link is necessary.
example of creation view:
CREATE VIEW sample_view AS
SELECT e1.Ename, e2.Empno, e1.Deptno
FROM table1 t1, table2 t2, table3@remotedb t3, table4@remotedb t4
WHERE t1.id = t2.id and t3.id=t4.id; --you can join all tables as you want
to overview of view please refer to : http://www.dba-oracle.com/concepts/views.htm
Edited by: Ulfet Tanriverdiyev on Aug 3, 2010 2:56 AM
Similar Messages
-
How to create a view between two table under different database?
thx
Assuming the different database is Oracle, you'll probably need to create a 'dblink'. Researching that topic should get you where you need to go.
-
Union in CDS View with different columns
Hello,
I have two entities E1 {a: Integer; b: Integer} and E2 {a: Integer; c: Integer} and I want to build a CDS view which does a union on both like:
SELECT a, b, null as c FROM E1
UNION SELECT a, null as b, c FROM E2
I have written the following:
view UnionView as select from E1 {a, b, null as c} union select from E2 {a, null as b, c}
Now I get the error message: Feature is not supported
Has anybody an idea, how to model this with a CDS view? With a graphical calculation view, this is possible, but I want to build it as a CDS view.
Regards,
MichaelWhat revision is your system on? I show that UNION was new syntax in SPS 09.
http://help.sap.com/hana/SAP_HANA_Core_Data_Services_CDS_Reference_en.pdf
I tried the following in my system and it worked just fine:
namespace playground;
@Schema: 'PLAYGROUND'
context unionDemo {
entity E1 {
key a : Integer;
b : String(20);
c : LocalDate;
entity E2 {
key x : String(20);
y : LocalDate;
z : Integer;
view V as
select from E1 { a, b, c}
union
select from E2 { z, x, y}; -
APEX Application accessing data from two different databases
Hi All,
Currently as we all know that APEX Application resides in database and is connected to the schema of that database.
I want APEX Application to be running and accessing data from two different databases. Elaborating my question,
Currently, my APEX Production Application is connected with XXXX Schema of DB1 Database(Where APEX Resides). Now I want to add some pages into this APEX Application for REPORT Purpose, But I want to connect this REPORT APEX Pages to get data from Different Schema YYYY for Database DB2.
Is it possible to configure this scenario?
The reason for doing this is to avoid the REPORT related (adhoc queries) resource utilization effect on Production DB1 Database.
Thanks
Nil1. If you do the joining of two or more tables in DB1 then all data is pulled over to DB1 and then the join is executed: so more data over the databaselink and more work for DB1. Better keep the joining stuff where the data resides and just pull exactly that data over that you need.
2. Don't know about your different block sizes. Seems a nice question for one of the other forums (DBA or SQL).
3. I mean create synonyms on DB1 for reports VIEWS in DB2.
Hope all is clear! -
How to create a view consisting of data from tables in2 different databases
Using Oracle 10.2g
I have 2 databases Gus and haggis on Comqdhb schema.
glink indicates a databse link between Haggis and Gus
In Gus there are tables student,subject,grade,school containing columns like upn...
STUDENT
upn
academicYear
SUBJECT
subject
GRADE
examlevel
grade
SCHOOL
sn
In HAGGIS there are tables student,grade,teacher containing columns upn...desc below.
STUDENT
upn
GRADE
grade
upn
academicyear
level
Create view in your HAGGIS database which will join all of the exam grades together. You should have one view which will produce the following relation :
examGrade(upn, subject, examlevel, sn, grade,academicYear)
so I need to create a view which gets the data from both the tables in both the databases.
create view as examGrade(upn, subject, examlevel, sn, grade,academicYear) as select s.upn
But i am not getting how to select a column from 2 tables in different databases
I mean if i said
select upn from comqdhb.student@glink,comqdhb.student;
select upn from comqdhb.student@glink,comqdhb.student
ERROR at line 1:
ORA-00918: column ambiguously defined
help me out,Thank you.Thank you for the reply will follow up the code format
Create views in your HAGGIS schema database which will join all of the exam grades together. You should have one view which will produce the following relation :
examGrade(upn, subject, examlevel, sn, grade,academicYear)
I understand that there wont be duplication when we use conditions
If i query
select count(upn)
from comqdhb.student@glink I get 9000
but after the union
create view examGrade(upn, subject, examlevel, sn, grade,academicYear)
as
select distinct s.upn as upn
, g.subject as subject
, g."LEVEL" as examlevel
, g.grade as grades
, '9364097'
, to_number(g.academicyear) as academicyear
from comqdhb.student s
, comqdhb.grade g
where s.upn=g.upn
union
select s.upn
, sb.subject
, g.elevel
, g.grade
, s.acyr
, sc.sn
from comqdhb.subject@glink sb
, comqdhb.student@glink s
, comqdhb.gradevalues@glink g
, comqdhb.school@glink sc,
, comqdhb.studentingroup@glink sg
, comqdhb.teachinggroup@glink tg
where sb.sid=tg.sid
and tg.gid=sg.gid
and sg.upn=s.upn
and g."LEVEL"=tg.elevel
and s.school=sc.id
and sc.id=tg.id; returns
count(upn) from exam gradeIt gets stuck actually sometimes it returns
932002 some results.
2:
Another problem i am having which i am trying to solve and written up my ideas but haven't been getting the expected results.Hope you can help.Thank you.
Information:
=======
All children take exams at the age of 16 called a General Certificate of SecondaryEducation (GCSE).
They have to study and take exams in Mathematics, English and Science, and can take other subjects such as History, French, Art etc. Most students will study between 5 and 10 different subjects before taking their GCSEs.
For each exam, a student is awarded a grade from A*, A, B,C,D,E,F,G,U,X An A* grade is the best grade achievable and an X is the worst grade.
In order to analyze how students have performed, each grade is mapped to a numeric value as follows:
Grade Numerical score
A* 8
A 7
B 6
C 5
D 4
E 3
F 2
G 1
U 0
X 0
Now why i need this avgGCSE is because i have to create a view containing avgGCSE of the students it is used in the next question where a condition is avgGCSE is between 6.5 and 7
In order to calculate the avgGCSE the idea is to calculate the grades of the students and map the grades to their corresponding scores/values
add them all up and div by the total no of grades to get the avg.
desc comqdhb.STUDENT@glink;
STUDENT
=======
UPN
FNAME
CNAME
DOB
GENDER
PREVIOUSSCHOOL
XGCSE
SCHOOL
ACYR
STUDENTINGROUP
=============
UPN
GID
STARTDATE
ENDDATE
GRADE
GRADEVALUES
===========
GRADE
LEVEL
VALUE
I have a opinion that xgcse in STUDENT table refers to the avgGCSE which i want to calculate as when i asked my professor as to what xgcse he said that he forgot to take it out of the table and it is not necessary while creating avggcse.
select *
from comqdhb.student@glink
where xgcse<6.5; Displaying a result
returns:
UPN FAMILYNAME COMMONNAME DATEOFBIR GENDER PREVIOUSSCHOOL XGCSE SCHOOL ACYR
===========================================================================
1011 KIMBERLY ABBOT 07-JUL-79 f none 3.93500948 2 2
select *
from comqdhb.student@glink
where xgcse between 6.5 and 7 and upn = 1386; Displaying a result
returns:
UPN FAMILYNAME COMMONNAME DATEOFBIR GENDER PREVIOUSSCHOOL XGCSE SCHOOL ACYR
===========================================================================
1386 STEPHANIE AANNESSON 15-JAN-79 f none 6.88873 2 2 so if xgcse is the avgGCSE then upn 1011 has avggcse<6.5 and 1386 has avggcse >6.5
my idea was backward strategy like so now if we find out upn 1368 has suppose xgcse(avggcse)>6.5 how to extract the avggcse for the particular upn We need to map grades from GRADEVALUES to grade in STUDENTINGROUP and map upn from studentingroup to upn in student to output the values for the corresponding grades from GRADEVALUES
select grade
from comqdhb.studentingroup@glink
where upn = 1011;
Result:
GRADE
=====
D
F
B
E
C
E
E
B
8 rows selected. Mapping each grade to the corresponding value and calculating we get
32/8=4 total(values to corresponding grades)/no of grades.
But the xgcse for upn 1011 is 3.935 and i am getting 4!! maybe xgcse isn't avggrade but ? is the procedure by me correct for calculating avggcse
select grade
from comqdhb.studentingroup@glink
where upn = 1386;
Result:
GRADE
======
A*
A*
A*
A*
B
A*
A*
A
B
B
B
11 rows selected. grade to the corresponding value and calculating we get
79/11=7.12 total(values to corresponding grades)/no of grades.
But the xgcse for upn 1011 is 6.88... and i am getting 7.12!!
But another problem
when i say
select g.value,g.grade
from comqdhb.gradevalues@glink g
, comqdhb.studentingroup@glink sg
where g.grade=sg.grade
and sg.upn=1011;
result:
======
VALUE GRADE
===========
100 B
100 B
80 C
60 D
40 E
40 E
40 E
20 F
6 B
6 B
5 C
VALUE GRADE
=============
4 D
3 E
3 E
3 E
2 F
16 rows selected.
select distinct g.value,g.grade
from comqdhb.gradevalues@glink g
, comqdhb.studentingroup@glink sg
where g.grade=sg.grade
and sg.upn=1011;
result:
======
VALUE GRADE
============
2 F
100 B
6 B
3 E
60 D
5 C
4 D
80 C
40 E
20 F
10 rows selected. I am getting only 8 for the query
select grade
from comqdhb.studentingroup@glink
where upn = 1386; here its becomming 10 and also its displaying values as 100 and ...
select distinct *
from comqdhb.gradevalues@glink;
GRADEVALUES
===========
LEVEL GRADE VALUE
================================
a A 120
a B 100
a C 80
a D 60
a E 40
a F 20
a U 0
a X 0
g A 7
g A* 8
g B 6
LEVEL GRADE VALUE
================================
g C 5
g D 4
g E 3
g F 2
g G 1
g U 0
g X 0
18 rows selected. I was hoping if i could map the grades and get the values and calculate avggrade by total(values)/count(values)that would be it but here there are values like 100...
select sum(g.value)/count(g.grade) as avggrade
from comqdhb.gradevalues@glink g
, comqdhb.studentingroup@glink sg
where g.grade=sg.grade
and sg.upn=1386;
avggrade
========
37.4375 the avggrade cant be this big and when i map each grade i obtained for 1368 like a to 7+b to 6 so on i get avggrade 7.12
kindly help.
Edited by: Trooper on Dec 15, 2008 4:49 AM -
How to add two different database connections on Model
Hi,
In my application, I need to create View Objects on different databases. So I need to add two different database connections on the Model.
But it seems like Model can be connected to only one database. I tried adding another project to add the second db connection. But after I created a read-only View Object in the second project, it didn't generate corresponding data control in the Data Controls panel.
Could anyone help me on this?
Thanks!Do you mean adding the second project folder in ViewController->Project Properties->Libraries and Classpath?Yes, either that or: ViewController -> Project Properties -> Dependencies
And I didn't see the first Model project in the ViewController classpath. Otherwise it wouldn't work. The first model project IS in 'classpath'. Here's how:
ViewController -> Project Properties -> Dependencies
I tried this and recreated the View Object. Still didn't generate the datacontrol. No idea why you had to recreate the VO.
Is your VO in an application module inside the SECOND project?
After you are sure that everything is in the ViewController's classpath, just try restarting JDeveloper.
This is very basic. has to work. -
Connecting to two different database instances from a swing application.
Hi All,
I am developing a swing application which needs to interact with two different database instances of two different weblogic servers.
More eloborately,
I have some data in DB_Instance1 running on[b] Weblogic_Server1 and I need to insert the same data into DB_instance2 running on Weblogic_server2. Is it possible. Could some explain me how to do that..
Thanks in advance...
Sreekanth.Hi Rick,
Try logging onto both Server first. You'll have to use either 2 separate ODBC DSN's or 2 separate OLE DB connections. Set them both for Trusted Authentication, you'll have to configure that on the Server also.Then try your query.
If that doesn't work then you'll have to create a Stored Procedure or View that can link the 2 Server side.
Thank you
Don -
View running slowly on different database
Hi,
I have an issue where a view which runs quickly on two different databases runs slowly on a 3rd database. The database schema is the same on all 3 machines. The two databases that run the view quickly are v.9.2.0.1.0, and v.10.2.0.2.0, the 3rd database that runs the view slowly is v.9.2.0.7.0. The physical machine that the 3rd database runs on is the fastest machine.
On the poorly performing database, if I set autotrace on, then I get this:
Statistics
36 recursive calls
0 db block gets
618169 consistent gets
10 physical reads
0 redo size
406 bytes sent via SQL*Net to client
499 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
obviously, the sheer number of consistent get's has to be the source of the problem.
explain plan doesn't reveal anything obvious.
I'm struggling to resolve the issue. Any help or pointers would be appreciated.The indexes are the same. I've also tried rebuilding the indexes.
Auto traces for the other 2 boxes
Statistics
0 recursive calls
0 db block gets
221 consistent gets
0 physical reads
0 redo size
379 bytes sent via SQL*Net to client
499 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
Statistics
0 recursive calls
0 db block gets
2 consistent gets
0 physical reads
0 redo size
255 bytes sent via SQL*Net to client
369 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed -
Comparing Tables In Two Different Databases
Hi,
As part of our project, we need to perform table comparisons in two different databases. I am currently looking for various options to accomplish this.
One of them is doing minus operation between these two tables.
Also, i have looked at the data compare option in toad utility.
Please suggest me any other options that makes my job easy.
Thanks in advance,
SueThen just adapt the select that is there
SELECT stid , c1, c2, c3
FROM
( SELECT a.*,
1 src1,
to_number(null) src2
FROM a
UNION ALL
SELECT b.*,
to_number(null) src1,
2 src2
FROM b
GROUP BY stid , c1, c2, c3
HAVING count(src1) count(src2)
order by stid;Best regards
Mohamed Houri -
Problems creating a view that's a union of two other views
Hello all you Oracle folks,
I'm pretty new to this Oracle thing, coming over from SQL Server where life was simple. Here's my issue;
I am trying to create a view that is a union of two other views.
I can run the top SELECT of this view (before the UNION) and it works no problem, and I can run the bottom SELECT (after the UNION) and it also works with no problem. I can run a DESC on both views involved, and those also work without any problem.
When I try to run the SQL all together though, I get this;
SQL> CREATE materialized view trkmaster.cmp_pmr_union refresh force ON demand AS SELECT 'CMR'
2 "Ticket_System", "Id_col" "Ticket", "Submitter", "Submit_Date", "Submit_To",
3 "Actual_Activity_Start_Date" "Start_Date", "Actual_Activity_Start_Time" "Start_Time",
4 "Actual_Activity_End_Date" "End_Date", "Actual_Activity_End_Time" "End_Time",
5 "Close_Date", "Risk_Level" "Level", "Activity_Type" "Type", "Activity_Category"
6 "Category", "Hardware_Name" "Hardware", "Platform", "Application_Name" "Application",
7 "Completion_Status" "Status", "Area_CMPO" "Owner", "Outage_Minutes" "Total_Outage_Mins",
8 "Acorde_Downtime__in_minutes_" "Acorde", "Atlas", "Corporate_Email_Downtime"
9 "Corporate_Email", "Data_Warehouse_Downtime__In_M6" "Data_Warehouse",
10 "E__Commerce_Downtime__In_Mins_" "ECommerce", "FMDS__FIVR_" "FMDS_FIVR",
11 "FMDS_Hotels_Downtime" "FMDS_Hotels", "FMDS_Internet_Downtime" "FMDS_Internet",
12 "FMDS_Resv__Ctr_Downtime" "FMDS_Resv_Ctr", "GDS_Downtime__In_Mins_" "GDS",
13 "HI_Online_Downtime__In_Mins_" "HI_Online", "Holidex__CRO____In_Mins_" "Holidex_CRO",
14 "Holidex__Hotels____In_Mins_" "Holidex_Hotels", "Hyperion_Essbase",
15 "IHGMail_Downtime__In_Mins_" "IHG_Mail", "Kofax_Downtime__in_minutes_" "Kofax",
16 "PeopleSoft_Fin_Downtime_In_Mi1" "Peoplesoft", "PERFORM__HIRO____In_Mins_" "Perform_HIRO"
17 FROM CMP.CHRQVCHANGE_MANAGEMENT_REQUEST UNION SELECT 'PMR' "Ticket_System", "Id_col"
18 "Ticket", "Submitter", "Submit_Date", "Submit_To", "Problem_Start_Date" "Start_Date",
19 "Problem_Start_Time" "Start_Time", "Problem_End_Date" "End_Date", "Problem_End_Time"
20 "End_Time", "Close_Date", "Severity_Level" "Level", "Problem_Type" "Type",
21 "Occurrence_Type" "Category", "Hardware_Name" "Hardware", "Platform", "Application_Name"
22 "Application", "Close_Code" "Status", "Problem_Owner" "Owner",
23 "TOTAL_Outage_Time__If_Any_" "Total_Outage_Time", "Acorde_Downtime__in_minutes_" "Acorde",
24 "Atlas", "Corporate_Email_Downtime" "Corporate_Email", "Data_Warehouse_Downtime__In_M6"
25 "Data_Warehouse", "E__Commerce_Outage_Time__Mins_" "ECommerce", "FMDS__FIVR_" "FMDS_FIVR",
26 "FMDS_Hotels_Outage_Time__In_M5" "FMDS_Hotels", "FMDS_Internet_Outage_Time__Mi4"
27 "FMDS_Internet", "FMDS_Resv__Ctr_Outage_Time__M3" "FMDS_Resv_Ctr",
28 "GDS_Outage_Time__Mins_" "GDS", "HI_Online_Outage_Time__In_Min2" "HI_Online",
29 "Holidex__CRO____In_Mins_" "Holidex_CRO", "Holidex__Hotels____In_Mins_" "Holidex_Hotels",
30 "Hyperion_Essbase", "IHG_Mail_Outage_Time__In_Mins_" "IHG_Mail",
31 "Kofax_Downtime__in_minutes_" "Kofax", "PeopleSoft_Fin_Downtime_In_Mi1" "Peoplesoft",
32 "PERFORM__HIRO____In_Mins_" "Perform_HIRO" FROM PMR.CHRQVPROBLEM_MANAGEMENT;
"PERFORM__HIRO____In_Mins_" "Perform_HIRO" FROM PMR.CHRQVPROBLEM_MANAGEMENT
ERROR at line 32:
ORA-00942: table or view does not exist
The 'CMR' and 'PMR' as Ticket_System is me trying to assign a literal as a newly created column.
All the data types match from one view to the other.
If I switch around the SQL so the 'CMR' view is at the bottom and the 'PMR' view is at the top, it still errors out on the 'PMR' view as not existing, even though I can DESC it and run the SELECT using that view. A coworker thinks it could be some kind of view alias issue (?).
I know the view exists, and I can access it no problem. Any ideas why this isn't working? It seems so simple, I could do this in a heartbeat in SQL Server. I have very few hairs left to rip out, so any help would be appreciated.SELECT 'CMR' "Ticket_System",
"Id_col" "Ticket",
....you have wrapped up your columns with a double quotes and use an alias. i tried the same thing
but using a different table and it does not work.
SQL> desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NOT NULL NUMBER(2)
SQL> select "empno" "employee_number"
2 from emp;
select "empno" "employee_number"
ERROR at line 1:
ORA-00904: "empno": invalid identifier
SQL> how were you able to run the top level of your SQL before the UNION clause? did you run it thru some tools
other than SQL*Plus? -
How to use 'UNION' between two different databaseservers
Hello,
Could someone help me out. I am trying to find out if and how to use 'UNION' between two different databaseservers.
We have 2 different queries, each queries on a different database; one MySQL the other MSSQL.
Could someone tell me how to use 'UNION' between thes 2 queries?
Thanks in advance,
Samir BenallaHello
You may use openrowset statement, (OPENROWSET (Transact-SQL))., but before you use this, you must configure your server
sample:
SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;',
'SELECT GroupName, Name, DepartmentID
FROM AdventureWorks2012.HumanResources.Department
ORDER BY GroupName, Name') AS a
UNION
SELECT GroupName, Name, DepartmentID
FROM AdventureWorks2012.HumanResources.Department
ORDER BY GroupName, Name
With this you can define a connection using native client to server Seattle1, and execute a query there, The results will be spooled on your server.
Connectionstring
Server=[SERVER_NAME];datasource=[YOUR DATABASE NAME];user_id=sa;password=sapassword'
if you use FQDN on your Query, than the datasource parameter in connection string can be letf out.
Regards
János.
take care of performance, it can be very slow, -
Can I use two different database with DBSystemLoginModule?
Finally I can login with Database user id by DBSystemLoginModule on Embedded oc4j server.
But I confused between [b]jazn-data.xml and system-jazn-data.xml.
Which xml do I have to edit for jdbcUrl and jdbcDriver?
Now I would like to use two different database(such as only sid is different).
In this case I want to show specific database name as realm name.
What should I do?
When I use DBSystemLoginModule, I edit JdbcUrl in system-jazn-data.xml.
So can I pass the parameter for sid programmatically?
And also I tried to run my application with other database with DBSystemLoginModule on Embedded oc4j server.
I changed few things(jdbcUrl at system-jazn-data.xml,jazn-data.xml in embedded-oc4j-server/config and database connection for BusinessComponents at Project Properties of Model/ViewController.
But I got some error.
Did I miss something?
----< my error messgae >------
500 Internal Server Error
JBO-30003: The application pool (customer.model.datamodel.CMAppModuleLocal) failed to checkout an application module due to the following exception:oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.NullPointerException, msg=null at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2002) Message was edited by:
Message was edited by:
sdcsdcI think I understand now, you are modifing the custom login modules configuration within the system-jazn-data.xml file. This is a bit dangerous! Didn't you register the login module in your orion-application.xml? For example, this is the way I do it:
<web-module id="customProv-web" path="customProv-web.war" />
<persistence path="persistence" />
<!--data-sources path="./data-sources.xml"/-->
<security-role-mapping name="sr_developer">
<group name="developers" />
</security-role-mapping>
<security-role-mapping name="sr_manager">
<group name="managers" />
</security-role-mapping>
<jazn provider="XML">
<property name="custom.loginmodule.provider" value="true"/>
<property name="role.mapping.dynamic" value="true"/>
<property name="role.compare.ignorecase" value="true"/>
</jazn>
<!-- Configuring a Login Module in an Application EAR file. -->
<jazn-loginconfig>
<application>
<name>customProv</name>
<login-modules>
<login-module>
<class>oracle.security.jazn.login.module.db.DBTableOraDataSourceLoginModule</class>
<control-flag>required</control-flag>
<options>
<option>
<name>data_source_name</name>
<value>jdbc/OracleDS2</value>
</option>
<option>
<name>roles_fk_column</name>
<value>userName</value>
</option>
<option>
<name>table</name>
<value>userinfo</value>
</option>
<option>
<name>groupMembershipTableName</name>
<value>groupinfo</value>
</option>
<option>
<name>groupMembershipGroupFieldName</name>
<value>role</value>
</option>
<option>
<name>usernameField</name>
<value>userName</value>
</option>
<option>
<name>user_pk_column</name>
<value>username</value>
</option>
<option>
<name>passwordField</name>
<value>passWord</value>
</option>
</options>
</login-module>
</login-modules>
</application>
</jazn-loginconfig>
<log>
<file path="application.log" />
</log>
<namespace-access>
<read-access>
<namespace-resource root="">
<security-role-mapping name="<jndi-user-role>">
<group name="administrators" />
</security-role-mapping>
</namespace-resource>
</read-access>
<write-access>
<namespace-resource root="">
<security-role-mapping name="<jndi-user-role>">
<group name="administrators" />
</security-role-mapping>
</namespace-resource>
</write-access>
</namespace-access>
</orion-application> -
How to handle transactions when two different databases are involved.
consider two tables namely Table-A and Table-B part of two different databases namely ORACLE and MYSQL.
Now the project requirement is updating the Table-A(ORACLE) and Table-B (MYSQL) as one transaction. i.e. either update both the tables or rollback both the tables.
Now my question is how could i handle this situation using JDBC(Type-4) driver.Because i think at a time only one JDBC driver can be loaded into the JVM.NareshAnkuskani wrote:
Now my question is how could i handle this situation using JDBC(Type-4) driver.Because i think at a time only one JDBC driver can be loaded into the JVM.No, that is not true.
But anyway, you need to use distributed (XA) transactions. i believe that the latest version (5.0) of mysql actually has support for XA transactions. you need to use a to setup a distributed transaction and attach the connections for the two databases to that transaction. then it should function as you desire. -
Synch Between Tables in Two different Databases
Synch between Two Tables in two different Databases.
I have two identical tables, table T1 in Database D1 and table T1 in Database D2. User can insert/update/delete/select from both of these tables in respective databases. Being said that how can keep them in Synch? Any thing added/modified/deleted should reflect in other. We like this to be Real-Time.
We are thinking of creating a cross (two way) DB link between them and then update/insert/delete both the tables when changing one. Any suggestions?
ThanksOne of my colleagues used snapshot in their previous projects, but he told me that the performance of it wind down while the records in tables increase. I have no idea about the exact situation, but I'm believing we'd think twice about it.
eilison
[email protected] -
Foreign Keys involving two different databases/schemas
Hi -- I'm wondering if it's possible to set a foreign key that involves tables that live in different databases/schemas. And, if it is possible, is it a horrible design idea?
Thanks,
~Christinecav0227, you have asked two different two part questions.
1 - Is it possible to set up FK that span owners and is this good design?
Yes, it is possilbe and there if the data is related then yes it is good design. We like to minimize the number of object owners in our system and use a table naming standard where the first two or three letters of the table name represent a system code: ap, ar, gl for accounts receivable, accounts payable, and general ledger. Other may prefer to have an AP owner, AR owner, and a GL owner.
Ownership has no direct bearing on quality of design. If the tables are related then you should define the FK no matter who the owner is.
2 - Is it possible to define FK to remote (distributed) tables and is the good design? The answer is no. FK cannot reference remote objects. To enforce referencial integrity accross databases via the database, rather than in the application, requires the use of table triggers.
As far as good design that depends on why the data is remote and why the tables need to be linked. There are issues related to availability, recovery, and performance when data is distributed. Having such a relationship could be good design or bad design depending on if all the inter-related factors have been considered.
IMHO -- Mark D Powell --
Maybe you are looking for
-
Questions on getting "other" data off ipad
I have been reading the threads, but before I do a full restore I have a few questions. I have about 2GB of "other" space on my 8GB ipad 2 (OS 7 withou the latest patch). I need to get rid of it because I can't load the new OS and I have the ipad dow
-
My persona stays the same no matter what I try to do...
I have been trying to change my persona to a Halloween persona. I do the appropriate things and press the "wear it" button but the persona stays the same and does not change. Am I doing something wrong??
-
GWIM 2.0.4 NetWare 6.5 sp 8 We recently moved many of our users to a different (parallel) OU in the tree. Today one of our managers noticed that her "search archive" menu option is missing. I checked the Messenger service's Archive ACL and the manage
-
Hello Fellow ABAPers, I have created a ALV grid report and by trapping the EVENT after_refresh and using method get_subtotals I have read the total lines, recalculated a couple colums based on the totals and using method refresh_table_display EXPOR
-
Can I use any tool or utility to make a content of a JAR file not accessible to unzip?