To access a sequence.nextval from Infobus applet
Hi
I have Infobus Dataform applet which displays the columns of the
table - timesheets which has a column "line_item" which has to
get it's value from a database sequence.
So I followed the approach followed in the Acme - sample
application ViewMembers.java.
Which the row added event of the RowsetInfo -
The following code was added with my Rowset and sequence used.
void ACME_MEMBERSIter_rowAdded(RowChangeEvent e) throws
java.sql.SQLException,
javax.infobus.DuplicateColumnException,
javax.infobus.ColumnNotFoundException,
javax.infobus.InvalidDataException
RowsetAccess rsa = e.getDataItem();
DbAccess dba = rsa.getDb();
RowsetAccess seq = null;
seq = (RowsetAccess)dba.executeRetrieval(
"select acme_member_id_seq.nextval as
\"new_id\" from dual",
"infobus:/oracle/sessionInfo1/new_id",
null);
ImmediateAccess nv = null;
ImmediateAccess column_id = null;
nv = (ImmediateAccess)seq.getColumnItem("new_id");
column_id = (ImmediateAccess)rsa.getColumnItem
("MEMBER_ID");
column_id.setValue(nv.getValueAsString());
This does not work when I run it from Jdeveloper I have debugged
it an umpteen times and still no clue.
The statement
(RowsetAccess)dba.executeRetrieval(
"select acme_member_id_seq.nextval as
\"new_id\" from dual",
"infobus:/oracle/sessionInfo1/new_id",
null);
JUST DOES NOT WORK.
Please help.
Regards
Rajs
null
Hi Shachar,
When SEQUENCE_SETUP/RESETUP is called, I need to modify the arbitrary data.
Arbitrary data can be accessed in 2 ways (as per my knowledge)
1. GetNewStreamValue() & SetStreamValue() (for this I need AEGP_EffectRef which will be NULL for the new effect when it comes to SEQUENCE_SETUP/RESETUP).
2. If PF_ParamDef* params is not NULL then,
PF_Handle arbH = params[PARAM_ID]->u.arb_d.value;
CG_ArbData *arbP;
arbP = reinterpret_cast<CG_ArbData*>(PF_LOCK_HANDLE(arbH));
In the first way, when SEQUENCE_SETUP/RESETUP is called AEGP_EffectRef is NULL, so I cannot use it.
In the second way, when SEQUENCE_SETUP/RESETUP is called PF_ParamDef* params is NULL, so I cannot use it.
Any ideas?
Similar Messages
-
Top 5 queries - One of them is sequence.nextval from dual !!!!!
Hi All,
I am using ORACLE DATABASE 11g and Oracle Linux 5.
My intentions are to get the top resource consuming or time consuming queries from database in the particular time frame. I formed the below query to get the same :-
select a.SQL_FULLTEXT,
s.module,
s.cpu_time_total / 1000000,
s.iowait_total / 1000000,
s.fetches_total,
s.sorts_total,
s.executions_total,
s.loads_total,
s.disk_reads_total /
DECODE(s.executions_total, 0, 1, s.executions_total) reads_per_execution,
s.disk_reads_total,
s.direct_writes_total / 1024,
s.buffer_gets_total / 1204,
s.rows_processed_total,
s.elapsed_time_total / 1000000,
s.apwait_total / 1000000,
s.ccwait_total / 1000000,
s.plsexec_time_total / 1000000,
s.javexec_time_total / 1000000
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT h, v$sqlarea a
where s.parsing_schema_name = 'ST'
and s.executions_total != 0
and s.snap_id = h.snap_id
and a.SQL_ID = s.sql_id
and h.begin_interval_time > '03-NOV-11 09.30.00.000 AM'
and h.end_interval_time < ''03-NOV-11 12.30.59.999 PM'
and rownum <= 5
order by 15 desc;I assume that above query will give me top 5 sql or pl/sql queries which are consuming most resource or time. Please correct me if am wrong with the query.
The surprising fact is that I got the below query as the top most resource consuming query :-
SELECT REF_SEQ.NEXTVAL AS VAL FROM DUALI searched for all the code in the database and I was not able to find this line in any code. The fact is that this query should not take more than 1 second as we know that sequence nextval from dual table is very fast so, how can i get this as resource consuming query.
The output is as follows :- ( I have modified the output to show all the facts in detail. Here you can see that it shows the execution time as 10.002467 Seconds. In real this will get execute in less than a second.)
MODULE NAME := Banking
TOTAL CPU TIME := 8.299744 Seconds.
TOTAL IO WAIT TIME := .915287 Seconds.
TOTAL RECORDS FETCHED := 41128 Rows.
SORT OPERATION(S) := 0
TOTAL NO. OF EXECUTION(s) := 41128 Times.
TOTAL NO. OF TIME(S) OBJECT/QUERY LOADED/RELOADED := 5
DATA READ PER EXECUTION := .002139661544446605718731764248200739155806 KB.
TOTAL DISK READS := 88 KB.
TOTAL DISK WRITES := 0 KB.
TOTAL BUFFER READS := 4.92441860465116279069767441860465116279 KB.
TOTAL NO. OF ROW(S) PROCESSED := 41128
TOTAL EXECUTION TIME FOR ONE TRANSACTION := 10.002467 Seconds.
APPLICATION WAIT TIME := 0 Seconds.
CONCURRENCY WAIT TIME := .344575 Seconds.
PL/SQL EXECUTION TIME := 0 Seconds.
JAVA EXECUTION TIME := 0 Seconds.Please guide me for this method. How to understand the presence of this sequence.nextval query here.
The base requirement is I want a query which will give me top 5 resource/time consuming queries. I have took the help of AWR views in my logic. If you have any better idea let me know.
Thanks in advance.Try this
select *
from
select a.SQL_FULLTEXT,
s.module,
s.cpu_time_total / 1000000,
s.iowait_total / 1000000,
s.fetches_total,
s.sorts_total,
s.executions_total,
s.loads_total,
s.disk_reads_total /
DECODE(s.executions_total, 0, 1, s.executions_total) reads_per_execution,
s.disk_reads_total,
s.direct_writes_total / 1024,
s.buffer_gets_total / 1204,
s.rows_processed_total,
s.elapsed_time_total / 1000000,
s.apwait_total / 1000000,
s.ccwait_total / 1000000,
s.plsexec_time_total / 1000000,
s.javexec_time_total / 1000000
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT h, v$sqlarea a
where s.parsing_schema_name = 'ST'
and s.executions_total != 0
and s.snap_id = h.snap_id
and a.SQL_ID = s.sql_id
and h.begin_interval_time > '03-NOV-11 09.30.00.000 AM'
and h.end_interval_time < '03-NOV-11 12.30.59.999 PM'
order by 15 desc
)where rownum <= 5 -
Please Help me with long time oracle select sequence.nextval from dual
Hi
I'm in a real problem.In fact i have a J2EE5(JPA,Hibernate 3,EJB 3.0) project deployed at websphere 6 application server and i'm using Oracle 10 g R2.
Well i have a batch job that inserts into some table called AVERAGEBALANCE.
the problem is that when i have activated hibernate log i discoverd that the select from dual is the longest sql (it takes some times over second !!)
here is the log
11/07/2011 08:49:40,406 DEBUG SQL:DefaultQuartzScheduler-SimpleThreadPoolWorker-2 - insert into AVERAGEBALANCE (CDATE_, CUSER_, AVERAGEBALANCE_, AVERAGECREDITORBALANCE_, AVERAGEDEBITORBALANCE_, BEGINDATE_, CALCULATIONDATE_, CASHSUBACCOUNTCODE_, CASHSUBACCOUNTPK_, CODE_, ENDDATE_, NBCREDITORDAYS_, NBDEBITORDAYS_, TEDABCALCULATIONPERIODICITYPK_, VERSIONNUM_, PK_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
11/07/2011 08:49:40,468 DEBUG SQL:DefaultQuartzScheduler-SimpleThreadPoolWorker-2 - select this_.PK_ as PK1_465_0_, this_.CDATE_ as CDATE2_465_0_, this_.CUSER_ as CUSER3_465_0_, this_.UUSER_ as UUSER4_465_0_, this_.BALANCE_ as BALANCE5_465_0_, this_.BALANCETYPE_ as BALANCET6_465_0_, this_.CASHSUBACCOUNTPK_ as CASHSUBA8_465_0_, this_.CASHSUBACCOUNTCODE_ as CASHSUBA7_465_0_, this_.CODE_ as CODE9_465_0_, this_.CURRENCYPK_ as CURRENCYPK11_465_0_, this_.CURRENCYCODE_ as CURRENC10_465_0_, this_.ENDDATE_ as ENDDATE12_465_0_, this_.EXCHANGERATE_ as EXCHANG13_465_0_, this_.ORIGINBALANCEPK_ as ORIGINB15_465_0_, this_.ORIGINBALANCECODE_ as ORIGINB14_465_0_, this_.POSITIONDATE_ as POSITIO16_465_0_, this_.REVALUATIONDATE_ as REVALUA17_465_0_, this_.SUMOFCREDITS_ as SUMOFCR18_465_0_, this_.SUMOFDEBITS_ as SUMOFDE19_465_0_, this_.UDATE_ as UDATE20_465_0_, this_.VERSIONNUM_ as VERSIONNUM21_465_0_ from CASHAB this_ where this_.CASHSUBACCOUNTCODE_=? and this_.BALANCETYPE_=? and this_.POSITIONDATE_<? and this_.ENDDATE_>=? and this_.BALANCE_<>?
11/07/2011 08:49:40,468 DEBUG SQL:DefaultQuartzScheduler-SimpleThreadPoolWorker-2 - select AVERAGEBALANCE_.nextval from dual
11/07/2011 08:49:41,484 DEBUG SQL:DefaultQuartzScheduler-SimpleThreadPoolWorker-2 - insert into AVERAGEBALANCE (CDATE_, CUSER_, AVERAGEBALANCE_, AVERAGECREDITORBALANCE_, AVERAGEDEBITORBALANCE_, BEGINDATE_, CALCULATIONDATE_, CASHSUBACCOUNTCODE_, CASHSUBACCOUNTPK_, CODE_, ENDDATE_, NBCREDITORDAYS_, NBDEBITORDAYS_, TEDABCALCULATIONPERIODICITYPK_, VERSIONNUM_, PK_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)well i have increased the sequence cache in fact here is the creation code of the sequence.
CREATE SEQUENCE "COMPTAPERF5"."AVERAGEBALANCE_" MINVALUE 1 MAXVALUE 999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 400 NOORDER NOCYCLE ;i think that there is some oracle parameter to tune
Thanks in advance
Edited by: B.Mansour Nizar on 11 juil. 2011 01:04
Edited by: B.Mansour Nizar on 11 juil. 2011 06:33
Edited by: B.Mansour Nizar on 11 juil. 2011 06:34
Edited by: B.Mansour Nizar on 11 juil. 2011 06:34
Edited by: B.Mansour Nizar on 11 juil. 2011 06:35
Edited by: B.Mansour Nizar on 11 juil. 2011 06:35
Edited by: B.Mansour Nizar on 11 juil. 2011 06:36
Edited by: B.Mansour Nizar on 15 juil. 2011 07:42I found it.
It's not due to oracle but it's a hibernate issue.In fact if setting FlushMode to Manual.It wil flush the in memory entities after that it will fire the insert statement.
Here's the log.
15/07/2011 15:32:47,984 DEBUG SQL:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - select CASHAB_.nextval from dual
15/07/2011 15:32:47,984 TRACE AbstractBatcher:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - preparing statement
15/07/2011 15:32:47,984 DEBUG SequenceGenerator:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Sequence identifier generated: 20441
15/07/2011 15:32:47,984 DEBUG AbstractBatcher:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
15/07/2011 15:32:47,984 TRACE AbstractBatcher:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - closing statement
15/07/2011 15:32:47,984 DEBUG ConnectionManager:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - aggressively releasing JDBC connection
15/07/2011 15:32:47,984 DEBUG ConnectionManager:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
15/07/2011 15:32:47,984 DEBUG AbstractSaveEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - generated identifier: 20441, using strategy: org.hibernate.id.SequenceHiLoGenerator
15/07/2011 15:32:47,984 TRACE AbstractSaveEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - saving [com.bfi.cpt.bal.cas.CashAccountingBalance#20441]
15/07/2011 15:32:47,984 TRACE Versioning:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - using initial version: 0
15/07/2011 15:32:47,984 TRACE AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - flushing session
15/07/2011 15:32:47,984 DEBUG AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - processing flush-time cascades
15/07/2011 15:32:47,984 TRACE Cascade:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - processing cascade ACTION_PERSIST_ON_FLUSH for: com.bfi.cpt.cht.cas.CashSubAccount
15/07/2011 15:32:47,984 TRACE Cascade:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - done processing cascade ACTION_PERSIST_ON_FLUSH for: com.bfi.cpt.cht.cas.CashSubAccount
15/07/2011 15:32:47,984 TRACE Cascade:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - processing cascade ACTION_PERSIST_ON_FLUSH for: com.bfi.ref.cur.Currency
15/07/2011 15:32:47,984 TRACE Cascade:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - done processing cascade ACTION_PERSIST_ON_FLUSH for: com.bfi.ref.cur.Currency
15/07/2011 15:32:47,984 TRACE Cascade:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - processing cascade ACTION_PERSIST_ON_FLUSH for: com.bfi.cpt.bal.cas.CashAccountingBalance
15/07/2011 15:32:47,984 TRACE Cascade:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - done processing cascade ACTION_PERSIST_ON_FLUSH for: com.bfi.cpt.bal.cas.CashAccountingBalance
15/07/2011 15:32:47,984 DEBUG AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - dirty checking collections
15/07/2011 15:32:47,984 TRACE AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Flushing entities and processing referenced collections
15/07/2011 15:32:47,984 TRACE AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Processing unreferenced collections
15/07/2011 15:32:47,984 TRACE AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Scheduling collection removes/(re)creates/updates
15/07/2011 15:32:47,984 DEBUG AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Flushed: 1 insertions, 0 updates, 0 deletions to 3 objects
15/07/2011 15:32:47,984 DEBUG AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
15/07/2011 15:32:47,984 DEBUG Printer:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - listing entities:
15/07/2011 15:32:47,984 DEBUG Printer:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - com.bfi.ref.cur.Currency{translatedName=null, certain=false, iso3166=788, quotity=1, identifier=TND, creationUser=admin, internalCode=null, name=Dinars Tunisien, creationDate=2011-07-11 14:43:06, code=TND, versionNum=0, decimal=3, updateUser=null, updateDate=null, pk=136, decimalName=millimes}
15/07/2011 15:32:47,984 DEBUG Printer:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - com.bfi.cpt.bal.cas.CashAccountingBalance{cashSubAccount=com.bfi.cpt.cht.cas.CashSubAccount#400201, originBalanceCode=null, exchangeRate=null, sumOfDebits=0.0, endDate=31 décembre 9999, creationUser=bna, currencyPk=136, creationDate=2011-07-15 15:32:47, cashSubAccountCode=BNA/PCI_BNA/82-TND, code=2010-07-30/BNA/PCI_BNA/82-TND/AccountingDateBalance/TND, versionNum=0, originBalancePk=null, currency=com.bfi.ref.cur.Currency#136, updateUser=null, originBalance=null, balanceType=AccountingDateBalance, updateDate=null, positionDate=30 juillet 2010, sumOfCredits=10.0, pk=20441, cashSubAccountPk=400201, revaluationDate=null, balance=-10.0, currencyCode=TND}
15/07/2011 15:32:47,984 DEBUG Printer:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - com.bfi.cpt.cht.cas.CashSubAccount{name2=null, accountPk=81, name=null, versionNum=0, currency=com.bfi.ref.cur.Currency#136, updateDate=null, chartByEntity=com.bfi.cpt.cht.std.ChartByEntity#2, refAccount=null, currencyCode=TND, chartByEntityCode=BNA/PCI_BNA, refAccountCode=null, creationDate=2011-07-15 15:25:45, account=com.bfi.cpt.cht.cas.StandardAccount#81, freeKey10=null, freeKey11=null, chartByEntityPk=2, freeKey12=null, updateUser=null, refAccountPk=null, freeKey13=null, freeKey14=null, freeKey15=null, freeKey16=null, freeKey17=null, accountCode=PCI_BNA/81, freeKey18=null, freeKey19=null, freeKey0=null, freeKey1=null, freeKey2=null, freeKey3=null, freeKey4=null, freeKey5=null, freeKey6=null, freeKey7=null, freeKey8=null, freeKey9=null, number=82-TND, creationUser=bna, freeKey20=null, freeKey21=null, freeKey22=null, freeKey23=null, freeKey24=null, freeKey25=null, freeKey26=null, freeKey27=null, freeKey28=null, freeKey29=null, currencyPk=136, code=BNA/PCI_BNA/82-TND, freeKey30=null, freeKey31=null, freeKey32=null, pk=400201}
15/07/2011 15:32:47,984 TRACE AbstractFlushingEventListener:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - executing flush
15/07/2011 15:32:47,984 TRACE ConnectionManager:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - registering flush begin
15/07/2011 15:32:47,984 DEBUG UpdateTimestampsCache:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Pre-invalidating space [CASHAB]
15/07/2011 15:32:47,984 TRACE AbstractEntityPersister:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Inserting entity: [com.bfi.cpt.bal.cas.CashAccountingBalance#20441]
15/07/2011 15:32:47,984 TRACE AbstractEntityPersister:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - Version: 0
15/07/2011 15:32:47,984 DEBUG AbstractBatcher:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
15/07/2011 15:32:47,984 DEBUG ConnectionManager:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - opening JDBC connection
15/07/2011 15:32:47,984 DEBUG SQL:DefaultQuartzScheduler-SimpleThreadPoolWorker-4 - insert into CASHAB (CDATE_, CUSER_, BALANCE_, BALANCETYPE_, CASHSUBACCOUNTCODE_, CASHSUBACCOUNTPK_, CODE_, CURRENCYCODE_, CURRENCYPK_, ENDDATE_, POSITIONDATE_, SUMOFCREDITS_, SUMOFDEBITS_, VERSIONNUM_, PK_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)Edited by: B.Mansour Nizar on 15 juil. 2011 07:38
Edited by: B.Mansour Nizar on 15 juil. 2011 07:39
Edited by: B.Mansour Nizar on 15 juil. 2011 07:43 -
Sequence.nextval from user_sequences
Hello All,
I have a query,
When i do <sequence_name>.nextval from user_sequences it is giving me 151 records...why is it giving me 151 records?
Example:
Step1: Created sequence test_val_seq
CREATE SEQUENCE test_val_seq
START WITH 1
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
Step2: used the query Select test_val_seq.nextval from user_sequences where sequence_name='TEST_VAL_SEQ';
and o/p is
nextval
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Again..The question is why am i getting 151 records?Hi All,
Thanks for responding..
1. I knew that sequence_name.nextval from dual will give me the next value but to want know why seq.nextval from user_sequence gives that many rows..that is the reason why i posted this query.
2. Yes (select sequence_name.nextval from user_sequences where sequence_name='xyz') gives the nextvalues based on number of records in the user_sequences....(tested it). Thanks bunch. -
Access Flash Player position from Java Applet
Hallo Everybody,
as a part of my diploma thesis, I have on a HTML Page two
objects, one is a Flash Movie, streamed from a Flash Server, the
other is a Java Applet. In the Java Applet I have a button "Get
time of Movie". When the user clicks on this button, the Applet
shoud ask the Flash Player about it's actual position (min, sec)
and the Applet should get this information back. I think, with the
ExternalInterface Class might it be possible, but I have no idea
how. Could anybody help me?
Thanks
BeatHi!
I want to access from a java client application to an .Net WebService, can you help me with some code ???
Thankz! -
Accessing a web service from an applet
Using NetBeans 5.5.1, I have created a web application consisting of a web service, an applet and a jsp. The applet is the client of the web service. The application is deployed on Tomcat 5.5.17, which comes with the IDE. Since the web service and the applet reside on the same server, I do not need to sign the applet to contact the web service�at least that was what I thought. Asking for the jsp in my browser, however, results in a java.security.AccessControlException:
access denied (java.util.PropertyPermission xml.catalog.ignoreMissing read)
To my best knowledge, my applet is not accessing local resources or doing other things that require it to leave the sandbox, so I don't understand why it needs extra permissions. Could it be the generated web service client code that is causing the exception? What is it doing that it needs extra permissions? By bundling everything in one application, I was really hoping to avoid having to sign my applet...I performed some additional tests and it appears that when processing XML, java classes under the hood often need access to PropertyPermissions, ReflectPermissions, etc. So although your own code does not need to step out of the sandbox, system classes do. For example, try to create a JAXB context in an applet: unless you sign your applet or change your policy file, it will not work. Something to bear in mind when developing applets or deploying applications via JWS.
-
Access native methods from an applet
hi all
I am developping a applet which has to access the native method which is c++ code. but it does not work at all, even though it can be compiled well.
it returns
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.MemoInfo)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkLink(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at InfoShow.<clinit>(InfoShow.java:24)
... 11 more
who can give me some suggestions on accessing native method from applet! thx
regards
beginneryou don't have access to native code from an applet unless you've modified your policy file or you're using a signed applet.
-
Accessing JavaScript function from an Applet?
Hi,
I've found how to access an applet's method from Jscript, but can we do the inverse? I'd like to refresh some frames in my web pages from my applet.
The refresh of several frames could be done with a Jscript function but how can I call it from my applet?
Thanks!
Stephaneactually look at this link to make more sense
http://www.woodger.ca/jv_jsint.htm -
The security code won't let my applet access its own database (from its own server)..
I'm using getDocumentBase()
to try and tell it that it is my own damn file..
I keep getting :
java.securityAccessControlException: access denied <java.util.PropertyPermission jdbc.drivers write>
...etc.
This applet crap is really starting to piss me off. I can see why they came out with JSP.
All I need to do is access my database, update it, etc. It kind of defeats the purpose of being able to do jdbc from applets if you can't even access the database on your own damn server.
If you all don't have a clue, I'm freakin switching to PHP--I'm tired of this crap-I was thinking Java was a damn good language until I hit applets.The simple answer to your question is: Because of security concerns.
The somewhat longer answer is that directly accessing a database from an applet is generally not a good idea. A lot of security-critical code like DB username/password must be hidden in the applet which potentially can be downloaded (and disassembled) by anyone that hits your webpage. Maybe you do an intranet solution with trusted users but that is not what applets were originally designed for.
The clean way is to make your applet talk to a servlet that talks to your database.
If that is not the way you want to do it, make sure that all client policy files (yes, on the browser machine) contain the permissions that your applet needs. -
Need to access TestStand Sequence Step Parameters from Excel Macro
Trying to create an EXCEL spreadsheet containing a list of all steps in a TestStand Sequence including Parameter names and types. How can I access the parameter names and types from EXCEL Visual Basic? It seems the API provides access to sequence parameters, but not step parameters.
mmghost,
Unfortunately, in TestStand 2.0, it is not possible to access the step parameter information.
In TestStand 3.0, there are a few more APIs exposed that give you access to the step parameters. In TestStand 3.0, these are the steps you would take to get that information:
1) Get a hold of the step object of interest. There are many ways to do this. For instance, starting with the Sequence Context you can get the Sequence object, and then get a step object from the sequence.
2) From the Step object, get the Module object.
3) At this point, you need to cast the Module object to the specific adapater type module you are using. For this example, we will assume that we are using the CVI adapter, so we would cast the Module object to a CVIModule o
bject.
4) The CVIModule object contains a Parameters collection of type CVIParameters, which contains the type information.
For different adapter types you would just cast the Module object to a different specific module (LabVIEWModule, ActiveXModule, etc).
Matt P.
NI -
Accessing database from an applet
Hi
I'm trying to access the database (MS Access) using type 1 driver sun.jdbc.odbc.JdbcOdbcDriver from an applet client. It works fine with the java application and also using appletviewer after creating a policy file and ran using appletviewer -J-Djava.security.policy=testpolicy.policy Output.htm
But when i try to run through the applet, it throws the exception as
java.security.AccessException
Pls help me,
Thansk
L-m-tThere is another way of doing it. That is to sign the applet (or the applet jar-file). That way the browser displays a dialog to the user so he can press yes, to grant all permissions. I have not found a way (via a dialog) to let the user grant only the permissions you need for the database connection.
More information on: http://developer.java.sun.com/developer/technicalArticles/Security/applets/ -
Accessing an applet from another applet
Hi,
I created a web page with a bunch of applets running on it, and I need to comunicate them. Is it possible to access the public methods and variables of one applet from another applet ? How do I do it ?I recently read an article that described how to access other applets in the same page, but I didn't pay much attention to it because I don't write applets. However, a quick look at the API documentation for the java.applet package shows this:
"AppletContext: This interface corresponds to an applet's environment: the document containing the applet and the other applets in the same document."
So I would try to get an AppletContext and see what could be done with it. -
Accessing a sequence which does not exists
i have pl/sql code as below and the sequence value is displayed based on condition.In case the sequence does not exists and condition fails the pl/sql is not getting compiled and throws error saying that sequence does not exists.
For eg:
declare
i number;
begin
if ( 1=2) then
select top_seq.nextval into i from dual;
dbms_output.put_line('i'||i);
end if;
end;
in above sequence does not exist and condition is failed as it never access sequence, does the pl/sql code execute successfully and which is not happening as it throws error . sequence does not exists.910111 wrote:
Hi,
as Frank mentioned before, you can achieve that by using dynamic sql, see following example:
DECLARE
lc_sql VARCHAR2(4000);
ln_seqExists NUMBER := 0;
lc_seqName VARCHAR2(30) := 'TOP_SEQ';
i NUMBER;
BEGIN
SELECT NVL(COUNT(*),0)
INTO ln_seqExists
FROM user_sequences
WHERE sequence_name = lc_seqName;
IF ln_seqExists = 0 THEN
lc_sql := 'CREATE SEQUENCE ' || lc_seqName;
EXECUTE immediate lc_sql;
END IF;
IF ( 1 = 1) THEN
lc_sql := 'select top_seq.nextval from dual';
EXECUTE immediate lc_sql INTO i;
dbms_output.put_line('i: ' || i);
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END;
Regards
Not everything that can be done should be done ....
Before showing someone how to shoot themselves in the foot, it would be best to determine that shooting themselves in the foot is the best and most appropriate course of action. -
Oracle native sequencing: nextVal executed two times.
We are migrating from Weblogic 6.1 sp 5 & TopLink 3.6.3 to Weblogic 8.1 sp 2 & TopLink 9.0.4 and we are having this issue:
It seems that when assigning the sequence to new objets TopLink execs the nextVal for the sequence twice. In fact we probably wouldn't notticed it if it was just that, the problem is that TopLink seems to register the object into the cache with an oid and assigning the next one to the object stored in the database so we are getting NoSuchObjectException each time we try to access them.
Here is a dump of TopLink's log showing the problem:
[TopLink]: ServerSession(22807116)--Connection(0)--client acquired
[TopLink]: ClientSession(25858791)--Connection(0)--acquire unit of work: 10772417
[TopLink]: UnitOfWork(10772417)--Connection(0)--JTS register
[TopLink]: ServerSession(22807116)--Connection(17740413)--SELECT SEQ_BOOK.NEXTVAL FROM DUAL
[TopLink]: ServerSession(22807116)--Connection(17558511)--SELECT SEQ_PAGE.NEXTVAL FROM DUAL
[TopLink]: UnitOfWork(10772417)--Connection(0)--Before JTS Completion
[TopLink]: UnitOfWork(10772417)--Connection(25919386)--Begin batch statements
[TopLink]: UnitOfWork(10772417)--Connection(25919386)--INSERT INTO AUTHOR (NAME, OCA, OID) VALUES (?, ?, ?)
[TopLink]: UnitOfWork(10772417)--Connection(0)-- bind => [Roger Penrose, 2004-05-11 18:54:01.917, 442803]
[TopLink]: UnitOfWork(10772417)--Connection(25919386)--End Batch Statements
[TopLink]: ClientSession(25858791)--Connection(25919386)--Begin batch statements
[TopLink]: ClientSession(25858791)--Connection(25919386)--INSERT INTO BOOK (NAME, OCA, OID, OID_AUTHOR) VALUES (?, ?, ?, ?)
[TopLink]: ClientSession(25858791)--Connection(0)-- bind => [The Emperor's New Mind, 2004-05-11 18:54:01.92, 347404, 442803]
[TopLink]: ClientSession(25858791)--Connection(0)-- bind => [Shadows of the Mind, 2004-05-11 18:54:01.943, 347405, 442803]
[TopLink]: ClientSession(25858791)--Connection(25919386)--End Batch Statements
[TopLink]: UnitOfWork(10772417)--Connection(0)--After JTS Completion
[TopLink]: UnitOfWork(10772417)--Connection(0)--release unit of work
[TopLink]: ClientSession(25858791)--Connection(0)--client released
[TopLink]: ServerSession(22807116)--Connection(0)--client acquired
[TopLink]: ClientSession(116689)--Connection(0)--acquire unit of work: 32580168
[TopLink]: UnitOfWork(32580168)--Connection(0)--JTS register
[TopLink]: UnitOfWork(32580168)--Connection(0)--Before JTS Completion
[TopLink]: UnitOfWork(32580168)--Connection(17129104)--Begin batch statements
[TopLink]: UnitOfWork(32580168)--Connection(17129104)--INSERT INTO AUTHOR (NAME, OCA, OID) VALUES (?, ?, ?)
[TopLink]: UnitOfWork(32580168)--Connection(0)-- bind => [Benoit Mandelbrot, 2004-05-11 18:54:49.264, 442805]
[TopLink]: UnitOfWork(32580168)--Connection(17129104)--End Batch Statements
[TopLink]: ClientSession(116689)--Connection(17129104)--Begin batch statements
[TopLink]: ClientSession(116689)--Connection(17129104)--INSERT INTO BOOK (NAME, OCA, OID, OID_AUTHOR) VALUES (?, ?, ?, ?)
[TopLink]: ClientSession(116689)--Connection(0)-- bind => [Les objets fractals, forme, hasard et dimension, 2004-05-11 18:54:49.266, 347409, 442805]
[TopLink]: ClientSession(116689)--Connection(0)-- bind => [The Fractal Geometry of Nature, 2004-05-11 18:54:49.282, 347408, 442805]
[TopLink]: ClientSession(116689)--Connection(17129104)--End Batch Statements
[TopLink]: UnitOfWork(32580168)--Connection(0)--After JTS Completion
[TopLink]: UnitOfWork(32580168)--Connection(0)--release unit of work
[TopLink]: ClientSession(116689)--Connection(0)--client released
the test is about creating two objects (well, we are actually creating 6 objects in this sample as we are creating two "master" objects and adding two related (in a one to many relationship) objects to each one.)
The thing I would like you to notice is this:
The first AUTHOR object gets assigned the OID 442803 wether the next AUTHOR object gets the OID 442805 although we expected it to be 442804.
The same occurs with the objects in the "many" side of the relation. They get sibiling OIDs but with a gap of two OIDs when creating the last two.
I have been searching for simmilar problems in this forums and I found two posts:
Both where related to a bug of an older version of TopLink (9.0.3 I think) when using something different than a number for the sequence field of an object. I expect it to be fixed in 9.0.4 version as it seemed to be fixed even for the 9.0.3 version. May it be a regression bug?
Anyway, we are using BigDecimal on entity bean's sequence number and IIRC NUMBER(18) in Oracle tables.
Currently our TopLink version is: 9.0.4 (031126)
Our native sequence has an allocation size of 200 and it matches with SEQUENCEs defined in Oracle.
As we are migratting from TopLink 3.6.3 and we have not changed the sequence prealocation size (we have not touched the database at all) we don't expect the problem to be on sequence prealocation.
I must say we have changed the "default" JDBC driver that TopLink uses when doing the issuing the loging phase (which I think is a SUN driver) to an oracle.jdbc.driver.OracleDriver as we were having problems with timestamp locking.
Any idea?
Thanks in advance.
Ignacio.Solved!
It was my fault. I was doing a really nasty thing to the entity beans.
I must publicly thank my work mate (which is a pretty smart girl, I must say) in tracking down this issue.
Here is what (we think) was happening:
As I told in previous post in this post we are in the process of moving from TopLink 3.6.3 (EJB 1.1) to TopLink 9.0.4 (EJB 2.0). We do have a "super class" in our application where we had some common things of our entity beans, i.e. entityContext, oid and oca attributes. We have also some methods that retrieve and set values from and to the entity beans via value objects (in order to avoid the heavy RMI operations when doing it through "standard" getters and setters) well, it happened that the current implementation of the "batch setting" method used the getDeclaringMethods to update in both UPDATE and INSERT opperations entity attributes with the data of the value object.
When switching to EJB 2.0 we had to push down both the oid and oca attributes (in order of being able do deploy them) to each final entity bean and now they where being included in the setting process!
You can imagine an scenario like this:
1. ejbCreate() // TopLink issues the SELECT SEQ_XXX NEXT VAL FROM DUAL and sets the oid of the EJB
2. setAttributes() // transfer info from the value object to the newly created EJB: including a setOid(null)!
3. commit() (Before Completion)
4. TopLink detects that the damm object surprisingly DOES NOT have the oid attribute setted so it performs another SELECT SEQ_XXX NEXT VAL FROM DUAL in order to "fix" this big problem.
5. commit() (After Completion) // the object is written to the database with the second value from the sequence whereas the first value is used to identify the entity bean into the identity cache.
Well it may not be "exactly" what is happening but I'm sure we are not so far from reality with our assumptions.
Andrei Ilitchev, thanks for your interest, sorry I could not post this sooner. -
Infobus applet and temporary files
Hi,
I have made an infobus applet and deploy it with the OAS407.
Now I have seen, that each time I load the applet from the
OAS407 the applet create 15 files in my temp-folder with the
prefix jar_cache (for example: jar_cache40989.tmp).
There is no problem with creating but there is a problem with
deleting because there is no mechanism for automatic deleting.
So I have to delete these files manually but I think that this
is unuseable for end-user.
Does anybody know how to bypass this problem ?
Thanks.
Nils
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Nils Buering ([email protected]):
I ran into the same problem when I built an applet that uses DAC and runs the app module in the downloaded applet. The Java plugin 1.2.2 is creating these files in TEMP and these files are equal in size to the support jar and zip files downloaded to the browser. You can easily verify this by comparing file sizes (use the Properties facility when you right click a Windows file sname to see its exact size in bytes). The plugin does not delete these files when you exit the browser and thus re-creates them every time you restart the browser and access the applet from the web server potentially filling the user's disk.
SUN has fixed this problem with the 1.3 plugin. Ater downloading and installing the 1.3 plugin, you must edit the applet's HTML file to add two new PARAM options: "cache_option" and "cache_archive". See http://java.sun.com/j2se/1.3/docs/guide/misc/appletcaching.html for instructions (a document titled "Applet caching in Java Plug-in") on doing this. This basically tells the plugin to use its own caching, instead of the browser's and doing this, the jar files created in the user's TEMP directory are deleted when you kill the browser.
However, since Jdeveloper is not certified with Java 2 v1.3, I ran into problems with code that works under the 1.2.2 plugin. The applet no longer runs once its been downloaded: I get a permissions error in jbo.logging.show and jbo.logging.trace; to wit: (java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.sql.SQLPermission setLog). So switching to the 1.3 plugin will fix the buildup of jar files in TEMP problem; but your applets may no longer work! Best to wait until Jdeveloper is certified with 1.3 then you can run the 1.3 plugin successfully.
Hi,
I have made an infobus applet and deploy it with the OAS407.
Now I have seen, that each time I load the applet from the
OAS407 the applet create 15 files in my temp-folder with the
prefix jar_cache (for example: jar_cache40989.tmp).
There is no problem with creating but there is a problem with
deleting because there is no mechanism for automatic deleting.
So I have to delete these files manually but I think that this
is unuseable for end-user.
Does anybody know how to bypass this problem ?
Thanks.
Nils<HR></BLOCKQUOTE>
null
Maybe you are looking for
-
How do I make 29.97fps look like film?
Sorry for the novice questions, but all of my footage has been shot on a relatively inexpensive camcorder which records at 29.97fps. Is there any easy way to make it look like a 24fps film when I play it back on my NTSC television? I am relatively ne
-
My original purchase of the R61i, model 8932CTO, came with Windows XP because I requested that instead of Vista. Since then, I have installed the Windows 7 upgrade. I now get a message that says "windows failed to start. Insert your windows installat
-
Garbled fonts when generating a PDF file
Greetings all: I am currently creating a series of documents in FM10 which are then converted to PDF for eventual posting on the web.The first two converted to PDF okay (more or less). I created a chapter template which is used for making the third d
-
Dovecot is killing my internet access. How do I stop dovecot?
We recently changed servers and had a lot of issues with Mozilla Thunderbird Email. Now I find my folks cannot access our website because something called dovecot is accessing the server and not terminating -draining the resources on the server. I wi
-
Anti-virus software that won't effect my computer's performance.
Hi guys, I'm a college student and my University requires that every computer on the network have anti-virus software. Just to use the internet a scan is run everyday to check to make sure you have the software. I got Norton free from my school but i