Call *.jar inside the trigger (MS SQL)
Hi!
I'm just looking around google and can't find any good news.. The problem is: how to call *.jar inside the trigger. Trigger is stored in M$ Server.
Tnx, if any response! ;)
What?
Similar Messages
-
Dear experts,
I hope this is the right place to post such question. I have a web and desktop app developed using netbeans and to be built into a JAR(J) and WAR (W) file. I would like to know if it is possible for the (J) to call some other JAR (or .class) inside the (W)? Our ultimate goal is to share common classes between two apps, and hopefully no need to re-build the (J) when (W) is modified, or vice-versa. I hope my explaination is clear enough. Any comments and sugguestions is welcomed and appreciated, thanks.Remember that whatever servlet container (appserver) that you are using does not actually execute a WAR file but deploys its contents to a particular location.
The contents can be JAR's, classes, images, whatever, but you need to specifiy in the classpath the JARs and class files that you wish to use.
It is always a good idea though to rebuild the WAR file if you make a change to a JAR file that is contained in that WAR file. It should be rebuilt and redeployed.
It is not good to manually change Jar files after the WAR is deployed. -
How to acess a value of variable(calling prg) inside the methods of a class
Hi SapAll.
i wrote a program where i need to acess a value of a variable inside the class method.
for eg:
CALL METHOD gcl_utl_app_log->display_log
EXPORTING
it_edidc = lt_edidc
it_msg = lt_msg.
while debugging under the method 'DISPLAY_LOG' when i want to acess a value of a variable (calling program) i cont get that value but i can acess the value of the variable just before the CALL METHOD statement.
so can any body help me in finding the solution for this.
regards.
VarmaHi jhings.
i have delcared the variable in the main program like below
main program
PERFORM populate_z1edrmdseqnr01.
FORM populate_z1edrmdseqnr01 .
other code
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = gv_number_nr
object = lv_obj
IMPORTING
number = gv_nextno
move gv_nextno to gv_seqno.
EXPORT gv_seqno to memory ID 'MEM1'.
PERFORM FORM application_log.
FORM application_log.
CALL METHOD gcl_utl_app_log->display_log
EXPORTING
it_edidc = lt_edidc
it_msg = lt_msg.
ENDFORM
METHOD display_log.
IMPORT gv_seqno from MEMORY ID 'MEM1'.
*********when i save and check the above code iam getting the error as 'FiledGV_SEQNO is unknown,it is neither in one of specified tables not defined by 'DATA ' statement.**********
regards.
Varma -
Hi Experts,
i want to know , is it possible to call the RFC in side the smartform. In my requirement, i need some data from ECC system to display in the smartform of the CRM.
currently i am trying to call outside the smartform and pass to the same, but smartform is triggered from actions and due to other constrints i am not able to to do so..
hence kindly suggest me the other options or is it possible to fetch the data from the ECC to CRM usinfg the RFC inside the smartform.
Thanks in advance
PradeepHi,
I hope yes you can write the RFC fm code inside the layout of the smartforms, but the problem is if RFC could not able to fetch the data from R/3 some times, or if it could not able to find the right records then it will return with error / blank records. To avoid all this kind of problems its better to write the same code in your driver program. In case if you dont get the data from R/3 then you can control the layout set from triggering.
Regards,
Satya -
Calling jar inside dll methods
Hello,
Can anyone give me a brief explanation on how to use the methods of a dll (made on c++) from java?
I would like to put the dll inside the jar/cab file along with the java classes.
best regards
JonathanThank you, I checked the links which are were very instructional.
But I have one question remaining: How can I make reference to a dll inside my jar/cab file?
the line System.loadLibrary("xxx") load just dlls from the local machine?
best regards
Jonathan -
Startup class not found if included in a jar inside the ear
I have written a startup class, i have packed it in a jar file(along with some
other classes). This jar is then packed in side an ear file.(This way i get one
single distribution file). I have added the startup class in the config.xml using
weblogic console.But at start up weblogic is unable to find the class. How to
tell weblogic about the location of the class(classpath) which is inside the ear
file. Error i get is as follows
<Aug 21, 2003 8:07:23 PM IST> <Emergency> <WebLogicServer> <BEA-000342> <Unable
to initialize the server: weblogic.t3. srvr.FatalStartupException: Can't start
server due to startup class failure WISORCODES_SERVER - with nested exception:
[java.lang.ClassNotFoundException: com.wisor.common.wisorcodes.rmi.WisorCodesServer]>
*************************************************************************** The
WebLogic Server did not start up properly. Exception raised: 'weblogic.t3.srvr.FatalStartupException:
Can't start server due to startup class failure WISORCODES_ SERVER - with nested
exception: [java.lang.ClassNotFoundException: com.wisor.common.wisorcodes.rmi.WisorCodesServer]'
Reason: weblogic.t3.srvr.FatalStartupException: Can't start server due to startup
class failure WISORCODES_SERVER - wi th nested exception: [java.lang.ClassNotFoundException:
com.wisor.common.wisorcodes.rmi.WisorCodesServer] ***************************************************************************Shirish:
Classes that are scoped in the application are only visible within the
application, not to the system classloader.
If you want to have startup classses scoped inside an EAR then you need to
use Application lifecycle listeners to actually activate these startup
classes. Application lifecycle listeners are a replacement for startup
classes.
You can check out an example of this in 8.1:
$BEA_HOME/weblogic81/samples/server/examples/src/examples/splitdir/helloWorl
dEar
Docs for it are:
$BEA_HOME\weblogic81\samples\server\examples\src\examples\splitdir\helloWorl
dEar\javadoc\index.html
Check out:
$BEA_HOME\weblogic81\samples\server\examples\src\examples\splitdir\helloWorl
dEar\META-INF\weblogic-applcation.xml
<weblogic-application>
<listener>
<listener-class>examples.splitdir.hello.startup.ApplicationStartup</listener
-class>
</listener>
</weblogic-application>
and
$BEA_HOME\weblogic81\samples\server\examples\src\examples\splitdir\helloWorl
dEar
/appStartup/examples/splitdir/hello/startup/ApplicationStartup.java
Now if you have a "startup class" that needs to be accessible for the entire
Server for a set of applications, I suggest just writing a single EAR with a
dummy web-app (I think you may need a dummy module) and an applicaiton
lifecycle listener, and have this EAR deploy before any other apps.
Cheers
mbg
"Shirish" <[email protected]> wrote in message
news:[email protected]...
>
I have written a startup class, i have packed it in a jar file(along withsome
other classes). This jar is then packed in side an ear file.(This way iget one
single distribution file). I have added the startup class in theconfig.xml using
weblogic console.But at start up weblogic is unable to find the class. Howto
tell weblogic about the location of the class(classpath) which is insidethe ear
file. Error i get is as follows
<Aug 21, 2003 8:07:23 PM IST> <Emergency> <WebLogicServer> <BEA-000342><Unable
to initialize the server: weblogic.t3. srvr.FatalStartupException: Can'tstart
server due to startup class failure WISORCODES_SERVER - with nestedexception:
>
>
[java.lang.ClassNotFoundException:com.wisor.common.wisorcodes.rmi.WisorCodesServer]>
>
The
WebLogic Server did not start up properly. Exception raised:'weblogic.t3.srvr.FatalStartupException:
Can't start server due to startup class failure WISORCODES_ SERVER - withnested
exception: [java.lang.ClassNotFoundException:com.wisor.common.wisorcodes.rmi.WisorCodesServer]'
Reason: weblogic.t3.srvr.FatalStartupException: Can't start server due tostartup
class failure WISORCODES_SERVER - wi th nested exception:[java.lang.ClassNotFoundException:
com.wisor.common.wisorcodes.rmi.WisorCodesServer]***************************************************************************
>
>
>
>
>
>
>
>
>
>
> -
To call methods inside the same application is possible to use RMI ?
hello,
What I should like to know is if RMI can easily be used to implement comunication (calling methods) inside classes that are part of the one same application... This should be a restrict case to use RMI...
The reason to do it come from the need to use the instance of a class knonwing it only as Object... This can be good to do if some code is used for general pupose in many different contexts.
In this case you can pass to the "server class" a parameter 'o' of type Object (all the classes extend Object) of the "customer class" to get back informations if some elaboration happen inside the "server class"...
This purpose is generally implemented with event listeners, but perhaps it could be done easily using RMI too (I dont know it...).
Using RMI in this simple situation, don't should require anything of complicate (stub, .... mashalling parametres....) to have the reference to method of the "customer class" to call. The "server class" already recives a reference of the "customer class" how parameter of type Object, and the mame of the method too.
I propose a simple thoeric example to explain really what I said before:
Class Server {
String methodName;
Object obj;
pubic Server( Oject o , String metName){ // constructor
obj = o;
methodName = metName;
// some thing is done and, at last, the method callbakMethod() is executed
callbakMethod();
}// constructor
public void callbakMethod(){ // this method have the purpose to call customerMethod()
Class c = owner.getClass();
Method m = null;
try {
m = c.getMethod("callBackMethod",null);
* // (1)
// I think that here we could have the possibility to call
// the method customerMethod() belonging to class Customer..
// I don't know if it possible and ... (and if it is possible) I am not able to do it*
}// callbakMethod()
} // class Server
Class Custmer{
public Customer() { // constructor
Server s = new Server (this, "customerMethod");
} // constructor
customerMethod() { // I would this method is called from class Server
// do some thing.....
} //customerMethod
} // class CustomerMy ask is: it is possible to call customerMethod() from the Server class ?...
If the aswer is yes, I wold know the sintax to use to do it, please.
thank you
regards
tonyMrsangeloRMI doesn't help you in the slightest here. You can just realize it all using local method invocation. All RMI does is to make that remote. If the objects aren't remote there is no point.
-
How can I access user defined column(in query) inside the trigger?
Hi
I have 3 unions and each query displays different records on some criteria. I also have a column hard-coded
Ex:
select a.col1, a.col2,
add as update
from table1 a
where ...
union
select a.col1, a.col2,
change as update
from table1 a
where ...
union
select a.col1, a.col2,
del as update
from table1 a
where ...
And I need to display a column in the report only if update is Add. I was thinking of writing a format trigger for that field. But I do not know how can I access this user defined column named update in the trigger?
Any help?Try ":update" minus the double-quotes. Ex:
IF :update = 'add' THEN
RETURN(TRUE);
ELSE
RETURN FALSE;
END IF;
You'll want to place your hard-coded values in single-quotes. Ex:
select a.col1, a.col2,
'add' as update
- Brian -
Stellent UCM :: calling javascript inside the custom component
Hi Experts,
I am new to the stellent content server (Oracle content server). Currently we are working on the project which needs to be integrated with the content server for the content selection. I did some prototype to pass back the selection value to the parent window using the javascript window.opener.<parent java script> from a dummy page. Now i am customizing the content server custom component. Unfortunately i cannot be able to call back the parent javascript from the custom component. Seems the window.opener is null.
I have tried with windowUtils.getOpener() method which is available in the content server weblayout. Still i could not be able to call back.
Guys i am looking forward your idea ? If anyone knows the way to resolve this issue or any other best suitable way to handle this please ping me back.
Regards ThivaHi Experts,
I am new to the stellent content server (Oracle content server). Currently we are working on the project which needs to be integrated with the content server for the content selection. I did some prototype to pass back the selection value to the parent window using the javascript window.opener.<parent java script> from a dummy page. Now i am customizing the content server custom component. Unfortunately i cannot be able to call back the parent javascript from the custom component. Seems the window.opener is null.
I have tried with windowUtils.getOpener() method which is available in the content server weblayout. Still i could not be able to call back.
Guys i am looking forward your idea ? If anyone knows the way to resolve this issue or any other best suitable way to handle this please ping me back.
Regards Thiva -
I'm currently building a console launcher that automatically fetches the console UI classes from servers and then caches them to client machine. User can then launch console UIs of different kinds of servers using unified launcher.
My problem is that most of the console UIs are dependant of other libraries and extracting these libs inside the UI jar is not an option. I've tried to package all jars including the console UI application itself into a another jar but hitting the wall currently when I try to accomplish something like this:
1. Check if disk cache already contains the jar file with md5
2. If not fetch the jar to disk
3. Open the jar file
4. Fetch all jars inside the jar and pass them to new classloader from classloaderpool <- This is where i hit the wall as I can't figure how to make the classloading of jars inside another jar.
It seems that i can't create JarFile instances from inputstreams but only from specified filenames.
I tried to use uberjar from codehaus but couldn't figure how to instantiate the main class of the console ui with parameters from inside another application.I suddenly find myself with a similar problem. My app is deployed with webstart, but I need to put a jar file in there (edtftpj-1.3.2.jar) so it can use FTP. Where do I put it? Right now it's inside a lib directory, but it's not getting found by the app that calls it.
Help?
--- Eric -
Call procedure inside from another procedure.
I have Procedure Name stored in tables.
Based on certain logic i need to call some procedure.
Procedure will be called from inside the procedure.
How can i apply this logic.
Please provide any explain.
Regards,
AgrawalV
Message was edited by:
AgrawalVExample: Re: How to make a dynamic function call from within a package procedure
-
Display invalid pattern name while calling the procedure inside the package
Hi ,
I'am trying to call a package which is having procedure ,from JDBC in which one of the return type is Varray from the procedure.When i'am calling the procedure inside the package
from java showing invalid name pattern name.Just i'am placing the code snippet for package and calling java through package.
Package body
create or replace package body Rewards_Summary_Package as
PROCEDURE Rewards_Summary_Procedure
(v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2) AS
v_ACCRUALED_VAL NUMBER := 0;
v_USED_VAL NUMBER := 0;
/*v_TOT_ACCRUALED_VAL NUMBER := 0;
v_TOT_USED_VAL NUMBER := 0;
V_PR_TIER_ID VARCHAR2(30);
V_PR_CON_ID VARCHAR2(30);
V_EXPIRY_DT DATE;
v_month varchar2(30);
v_date date;
v_next_month_date date;
v_TIER_NAME VARCHAR2(50);
v_TOT_AVAILABLE NUMBER := 0;
v_EARNED NUMBER := 0;
v_TOT_EARNED NUMBER := 0;
v_TOT_REDEEMED NUMBER := 0;
v_TOT_EXPIRED NUMBER := 0;
v_EARNED_TOTAL NUMBER := 0;
v_TOT_EXPIRED_MONTH NUMBER := 0;
v_TOT_PTS_EXP NUMBER := 0;
v_TOT_RDMD_CANCELLED NUMBER :=0;
v_TOT_EARNED_POINTS NUMBER :=0;*/
v_FIRST_DT DATE;
v_LAST_DT DATE;
v_MEMBER_ID VARCHAR2(30);
V_EXPIRED_VAL Number;
v_TOT_PRDPTS_RDMD NUMBER := 0;
v_TOT_PTS_RDMD NUMBER := 0;
v_CAN_ACCRUAL_POINTS NUMBER := 0;
BEGIN
/*TotalRwdPoints and Tier Name*/
SELECT TR.NAME,MEM.POINT_TYPE_A_VAL,MEM.ROW_ID INTO v_TIER_NAME,v_TOT_AVAILABLE,v_MEMBER_ID
FROM SIEBEL.S_LOY_MEMBER MEM, SIEBEL.S_LOY_TIER TR WHERE MEM.PR_DOM_TIER_ID=TR.ROW_ID
AND MEM.PR_CON_ID=V_PR_CON_ID;
vTotPrdPtsRdmd
SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PRDPTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Product'
AND A.TXN_ID IS NOT NULL;
vTotPtsRdmd
SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND (A.TYPE_CD='Product' or A.TYPE_CD='Transfer')
AND A.TXN_ID IS NOT NULL;
vTotRewardPtExp
SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_EXP FROM SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Expired'
AND a.TXN_ID IS NULL;
vCanAccrualPoints
SELECT NVL(SUM(A.ACCRUALED_VALUE),0) INTO v_CAN_ACCRUAL_POINTS from SIEBEL.S_LOY_ACRL_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRIB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Cancellation';
v_Tot_Earned_Points := v_TOT_AVAILABLE+v_TOT_PRDPTS_RDMD+v_TOT_PTS_EXP-v_CAN_ACCRUAL_POINTS;
v_TOT_REDEEMED := v_TOT_PTS_RDMD-v_CAN_ACCRUAL_POINTS;
DBMS_OUTPUT.PUT_LINE(' Total Earned: '|| v_Tot_Earned_Points || ' Total Redeemed: '|| v_TOT_REDEEMED || ' Total Expired: '|| v_TOT_PTS_EXP
|| ' Balance Points: '|| v_TOT_AVAILABLE || ' Tier Name: '|| v_TIER_NAME);
select trunc(sysdate,'MONTH') INTO v_FIRST_DT from dual;
va:= t_varray(Null,Null,Null,Null,Null,Null);
FOR a in 1 .. 6 LOOP
select trunc(last_day(v_FIRST_DT)) INTO v_LAST_DT from dual;
SELECT SUM(AI.ACCRUALED_VALUE),SUM(AI.USED_VALUE) INTO v_ACCRUALED_VAL,v_USED_VAL from SIEBEL.S_LOY_ACRL_ITM AI,SIEBEL.S_LOY_ATTRDEFN A
WHERE AI.MEMBER_ID = v_MEMBER_ID AND A.ROW_ID = AI.ATTRIB_DEFN_ID AND A.INTERNAL_NAME = 'Point 1 Value'
AND trunc(AI.EXPIRATION_DT) >= v_FIRST_DT AND trunc(AI.EXPIRATION_DT) <= v_LAST_DT;
V_EXPIRED_VAL := NVL(v_ACCRUALED_VAL-v_USED_VAL,0);
va(a):=V_EXPIRED_VAL;
v_FIRST_DT := add_months(v_FIRST_DT,1);
End loop;
END;
end;
Package declaration
create or replace package Rewards_Summary_Package as
TYPE t_varray IS VARRAY(6) OF NUMBER;
PROCEDURE Rewards_Summary_Procedure
(v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2);
end;
java code
I had tried using java types and Oracle types
conn=SiebelServiceDatasource.getConnection(SSBConstants.REWARDS_PROP_LOG_SUFIX);
// ArrayDescriptor.TYPE_VARRAY
ocstmt=(OracleCallableStatement)conn.prepareCall(" {call REWARDS_SUMMARY_PACKAGE.REWARDS_SUMMARY_PROCEDURE(?,?,?,?,?,?,?)}");
//ocstmt=(OracleCallableStatement)conn.prepareCall(" call Test_Array(?,?)");
ocstmt.registerOutParameter(1,OracleTypes.INTEGER);
ocstmt.registerOutParameter(2,OracleTypes.INTEGER);//1-616BH
ocstmt.registerOutParameter(3,OracleTypes.INTEGER);
ocstmt.registerOutParameter(4,OracleTypes.INTEGER);
ocstmt.registerOutParameter(5,OracleTypes.VARCHAR);
ocstmt.registerOutParameter(6,OracleTypes.ARRAY,"SIEBEL.T_VARRAY");
ocstmt.setString(7,contactSiebelRowId);
ocstmt.execute();
Showing the following invalid name pattern SIEBEL.T_VARRAY
Please help
Thanks in advance
Kirancreate or replace package Rewards_Summary_Package as
TYPE t_varray IS VARRAY(6) OF NUMBER;
end;You've declared your type inside the package. You need to declare it as a SQL type, which is not part of a PL/SQL package. -
Can I call a Java program from a SQL Server Trigger?
Hello,
I want to encrypt some data in a database column in SQL Server. Today I am using java code to encrypt the value and store it in the database using JDBC.
Now I want to use a VB client to store the encrypted value in the SQL Server DB. Since the encryption is handled by a java class, can I write a trigger in SQL Server that while inserting the raw data, calls the java class for encrypting the value and then inserts the encrypted value into the column?
In general, is it possible to call a java class from a SQL Server trigger?
Thanks
BipinHere are 3 examples of code for insert, update and delete:
CREATE TRIGGER [PLI_INSERT_TRIGGER] ON [dbo].[PLI]
FOR INSERT
AS
Declare @cmd sysname, @code sysname, @list sysname
Select @code = PLI_K_COD, @list = PLI_K_LISTINO from inserted
Set @cmd = 'java mirrorDb.Copy PLI INSERT ' + @code + ' ' + @list
EXEC master..xp_cmdshell @cmd
CREATE TRIGGER [PLI_UPDATE_TRIGGER] ON [dbo].[PLI]
FOR UPDATE
AS
Declare @cmd sysname, @code sysname, @list sysname
Select @code = PLI_K_COD, @list = PLI_K_LISTINO from inserted
Set @cmd = 'java mirrorDb.Copy PLI UPDATE ' + @code + ' ' + @list
EXEC master..xp_cmdshell @cmd
CREATE TRIGGER [PLI_DELETE_TRIGGER] ON [dbo].[PLI]
FOR DELETE
AS
Declare @cmd sysname, @code sysname, @list sysname
Select @code = PLI_K_COD, @list = PLI_K_LISTINO from deleted
Set @cmd = 'java mirrorDb.Copy PLI DELETE ' + @code + ' ' + @list
EXEC master..xp_cmdshell @cmd
you must go "sql server entreprise manager" right click on the table you want to add triggers and select: all activities, manage triggers.
You have 3 examples: for an insert, for an update and for a delete
ON [dbo].[PLI] specify the table on which you want to setup trigger.
FOR DELETE, INSERT, UPDATE specify the event.
The Declare statement create the variables in which I want to put some values to pass to the java program, for example which table, which event, which key fields.
the "Select @code = PLI_K_COD, @list = PLI_K_LISTINO from inserted" set the variables with the value of the columns of the table I am interested to read from my java program, for example the variable @code receive the value of the column pli_k_kod (is the key) of the table PLI.
The "Set @cmd = 'java mirrorDb.Copy PLI DELETE ' + @code + ' ' + @list " prepared the variable @cmd with the java command followed by the package.classname and parameters.
The EXEC launch the command to the operating system.
Daniele -
How to read a file inside the JAR file
Hi All,
I want to save some preferences in a file called "preferences". I kept the preferences file under my java package.
If i am running the code inside the NetBeans 6.9 IDE it's working file. But once i have created a JAR and try to run the application, it couldn't find the path.
Please help me that how to resolve this issue. I don't want to save this preferences file outside of my JAR (i.e) within my java package.
Here is the code,
package mypackage;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
public class ReadFile
private void writeFile()
try
OutputStream out = new FileOutputStream(getClass().getClassLoader().getResource("mypackage/preferences").getPath().replace("%20", " "));
PrintWriter writer = new PrintWriter(out);
writer.println("Hello Java!");
writer.close();
out.close();
catch (Exception ex)
System.out.println(ex.getMessage());
private void readFile()
try
FileInputStream fi = new FileInputStream(getClass().getClassLoader().getResource("mypackage/preferences").getPath().replace("%20", " "));
BufferedReader br = new BufferedReader(new InputStreamReader(fi));
System.out.println(br.readLine().trim());
br.close();
fi.close();
catch (Exception ex)
System.out.println(ex.getMessage());
public static void main(String[] args)
ReadFile read = new ReadFile();
read.writeFile();
read.readFile();
}If i run the JAR, i get the following error message,
{color:#ff0000}*file:\my jar path\jarname.jar!\mypackage\preferences (The filename, directoryname, or volume label syntax is incorrect)*{color}Thanks sabre150,
sabre150 wrote:
You cannot update a running jar file. I am sorry. I didn't know about it. Thanks to point out.
There are two ways I approach this depending on my exact requirements -
1) use the java.util.prefs.Preferences APII will try this one
>
2) if not already present I copy the preferences file from the jar to a known place. I use a directory in the user's home directory and normally make the directory name the program with a '.' prefix.
One cannot access files in a jar file using the File API. One needs to use the getResource() or getResourceAsStream() methods on Class or ClassLoader. -
How to call procedure inside a procedure and need to sore the value in a variable?
HI ALL,
i am usung oracle 11g.
here is my package and procedure
i want to call get_email_details this procedure inside the process_email_master and want to keep the value inside a varible in master procedure
create or replace
PACKAGE ms_gen_process_email
as
type email_type is record(subject varchar2(4000 char),
email_body varchar2(4000 char),
to_receipent varchar2(4000 char),
cc_receipent varchar2(4000 char));
type email_type_table is table of email_type;
procedure process_email_master(
p_metric_name IN VARCHAR2,
p_current_stage in varchar2,
p_action in varchar2,
p_pid in number,
P_OBJECT_ID in varchar2
--p_emai_master out p_email_type_table
PROCEDURE get_email_details (
p_metric_name IN VARCHAR2,
p_current_stage in varchar2,
P_ACTION in varchar2,
p_email_type_table1 out email_type_table
END ms_gen_process_email;
create or replace
PACKAGE BODY ms_gen_process_email
as
procedure process_email_master(
p_metric_name IN VARCHAR2,
p_current_stage in varchar2,
p_action in varchar2,
p_pid in number,
p_object_id in varchar2
as
begin
null;
EXCEPTION
WHEN OTHERS
then
null;
end process_email_master;
PROCEDURE get_email_details (
p_metric_name IN VARCHAR2,
p_current_stage IN VARCHAR2,
P_ACTION in varchar2,
p_email_type_table out email_type_table
as
BEGIN
select subject, email_body, to_receipent, cc_receipent
bulk collect into p_email_type_table
from ms_gen_email_config_detail
WHERE email_key = (
SELECT email_key
FROM ms_gen_email_config
WHERE metric_name = p_metric_name
AND action = p_action
and current_stage = p_current_stage
for i in p_email_type_table.first..p_email_type_table.last loop
dbms_output.put_line(p_email_type_table(i).subject||p_email_type_table(i).email_body||p_email_type_table(i).to_receipent||p_email_type_table(i).cc_receipent);
end loop;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END get_email_details;
END ms_gen_process_email;
but i am getting this error
Error(15,31): PLS-00201: identifier 'P_EMAIL_TYPE_TABLE' must be declared
Regards
DambyIf you need to call a procedure which has yet to be defined in your package, you can use forward declaration...
That means that you declare the procedure/function before the place it's going to be called (typically people do this at the top of the package) without providing a body for the code...
PACKAGE BODY ms_gen_process_email as
PROCEDURE get_email_details
p_metric_name IN VARCHAR2,
p_current_stage IN VARCHAR2,
P_ACTION in varchar2,
p_email_type_table out email_type_table
); -- Forward declaration of get_email_details procedure
procedure process_email_master(
p_metric_name IN VARCHAR2,
p_current_stage in varchar2,
p_action in varchar2,
p_pid in number,
p_object_id in varchar2
as
begin
null;
EXCEPTION
WHEN OTHERS
then
null;
end process_email_master;
PROCEDURE get_email_details
p_metric_name IN VARCHAR2,
p_current_stage IN VARCHAR2,
P_ACTION in varchar2,
p_email_type_table out email_type_table
) as
Maybe you are looking for
-
Req any examples of high to use midi controller/keyboards with Labview TIA
Req any examples of high to use midi controller/keyboards with Labview TIA
-
How to install Mongolian Language in my language list
Hello, I couldn't find Mongolian language among language list. I have installed Mongolian font already but I couldn't type in mongolian cyrillic because there's no mongolian languae set up on my Mac. Please help!
-
Several nested loop at the same level in an execution plan
Hi, I am using 11gR2, and I've seen a execution plan in the trace of my SQL query (also shown in pl/sql explain plan) with 4 nested loops all at the same level, what does this mean? i.e. - SELECT STATEMENT, GOAL = FIRST_ROWS + NESTED LOOPS + NESTED L
-
New Webi Document Default Color - BOE XI 3.1 SP2
Hello. We would like to change the default color in a new webi document. I have changed defaultconfig.xml in the following paths. Tomcat55\webapps\AnalyticalReporting\ webiApplet\AppletConfig webiApplet\AppletConfig\AppletConfig WEB-INF\c
-
Select quantity depending on style # choosen – Part 2
HI, I have a drop down menu with 2 style numbers: 2602 and 2622 If the client choose 2602, then the number 20 gets written in the next field. If the client choose 2622, then the number 40 gets written in the next field. What would be the script for t