How to call tuxedo in Visial basic?
The version we are using is Tuxedo 6.5.
Now we want to call tuxedo in our VB application. but tuxedo is a field we have
little touch with.
So i have no idea how to bind these two together.
Hope you kindly give a hand (maybe some documents on this)
thanks a lot in advance. Look forward to the prompt reply!
1.In the VB IDE i have installed the SP5.
2.The version of the tuxedo is 6.5; %TUXDIR%\udataobj\patchlev is not found in
my system.
What is the file?
3. again,Would tpinit() works well without relevant server booted?
thanks for your prompt reply.
"Wayne W. Scott" <[email protected]> wrote:
I don't know; I haven't worked with that stuff. Since you said the error
is:
"vb6.exe have error occured -- will be closed by windows -- you will
need to restart
the program"
I would check to see that the VB or VS service packs have been installed.
Visual Studio had SP5 last time I looked.
Then, which version of Tuxedo do you have and is there a file called
%TUXDIR%\udataobj\patchlev ? If yes, what is the very LAST line in it?
Wayne
beawhycn wrote:
1. In the project you supply,there is a function as follow.
Function connectToTuxedo() As Integer
Dim iRet As Integer
Dim Msg As String
Dim msgresult As Integer
iRet = tpinit(ByVal 0&)
If iRet = -1 Then
Dim errMsg As String
errMsg = tpstrerror(ByVal gettperrno())
Msg = "Tpinit failed " + Str$(gettperrno()) + errMsg
msgresult = MsgBox(Msg, vbOKOnly)
End If
connectToTuxedo = iRet
End Function
when the programe comes to the line of "
errMsg = tpstrerror(ByVal gettperrno())
the VB IDE will be forced to close with the message:
vb6.exe have error occured£¬will be closed by windows £¬you will needto restart
the program¡£
add:in the OS's application report has the infor(event ID(1020) can'tbe found
in libwsc.dll.
I don't know the error is result from the libwsc.dll or my VB IDE
2. Can i run this example without Tuxedo client (just with some .dllin my path)?
Would tpinit() works well without relevant server booted? I ama layman@-@
Any comments or advise will be appricated.
Similar Messages
-
Hi All,
I am a developer and new for Tuxedo. For one of my application client (written in VC++) runs on Windows plateform and server runns on HP-UNIX. Client part reads server ip by WSNADDR environment variable however i am not able to identify how it is calling a particular service running on UNIX.
Can anybody please guide how it happens. Please also let me where can i get more material that can give me more idea ?Hi Todd,
I am quite sure that WSL is listening at the IP:Port pointed by WSNADDR because some existing application written in VC++ works fine. Also the existing application client not need to compile using buildclient option. Simply VC++ compiler/Linker creates EXE that runs fine.
Since i am new to the Tuxedo so just trying to figureout communication channel by writing simple progarm. When i created exe by default VC compiler then tperrno prints 12 once tpinit fails. What does this error number means?
I also tryed to create exe of my sample program using buildclient in following ways:
C:\>buildclient -f filename.cpp -w
and got following error:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
Command line warning D4024 : unrecognized source file type 'Files\Tuxedo32\include', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
Command line warning D4024 : unrecognized source file type 'C:\Program', object file assumed
client1.cpp
client1.cpp(5) : fatal error C1083: Cannot open include file: 'atmi.h': No such file or directory
TUXNT_CAT:77: ERROR: Can't execute cl /MD -I%TUXDIR%\include -Feclient client1.cpp %TUXDIR%\lib\libwsc.lib %TUXDIR%\lib\
libbuft.lib %TUXDIR%\lib\libnws.lib %TUXDIR%\lib\libnwi.lib %TUXDIR%\lib\libfml.lib %TUXDIR%\lib\libfml32.lib %TUXDIR%\lib\
libgp.lib wsock32.lib kernel32.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib -link -implib:BC-ba4.lib
Please tell me where i am doing the mistake. On my Windows XP system Tuxedo 6.3a is installed and TUXDIR points to C:\Program Files\Tuxedo32 -
How to call a bean method from javascript event
Hi,
I could not find material on how to call a bean method from javascript, any help would be appreciated.
RalphHi,
Basically, I would like to call a method that I have written in the page java bean, or in the session bean, or application bean, or an external bean, from the javascript events (mouseover, on click, etc...) of a ui jsf component. I.e., I would like to take an action when a user clicks in a column in a datatable.
Cheers,
Ralph -
How to call a exec prog in another prog
how to call a exec prog in another prog.
Hi,
SUBMIT
Basic forms:
1. SUBMIT rep.
2. SUBMIT (name).
Additions:
1. ... LINE-SIZE col
2. ... LINE-COUNT line
3. ... TO SAP-SPOOL List output to the SAP spool database
4. ... USING SELECTION-SCREEN scr
5. ... VIA SELECTION-SCREEN
6. ... AND RETURN
7. ... EXPORTING LIST TO MEMORY
8. ... USER user VIA JOB job NUMBER n
9. ...Various additions for passing parameters to rep
10. ... USING SELECTION-SETS OF PROGRAM prog
Effect
Calls report rep.
Regards,
Andrej. -
How to call BAPI in a ABAP prog
Hi All
I have a concern regarding the usuage of BAPI in the ABAP program.
i have successfully created a BAPI and i have implemented a method as well using ADD API Method button.
Now after doin all the things in SWO1.
I wanted to know how to call this BAPI method in se38.
CAn anyone throw some light on this ?
Regards
GauravHi,
try this
*& Report ZKAR_MATMAS_BAPI
*& This program demonstrates how easy it is to create Material master
*& data using BAPI_MATERIAL_SAVEDATA
*& The program also generates a report post-execution displaying errors
*& as well as successful uploads
REPORT ZKAR_MATMAS_BAPI.
* TABLES
* FLAGS *
DATA: F_STOP. " Flag used to stop processing
* DATA DECLARATIONS *
DATA : V_EMPTY TYPE I, " No. of empty records
V_TOTAL TYPE I. " Total no. of records.
* STRUCTURES & INTERNAL TABLES
*BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2. " Return Parameter
*--- Internal table to hold excel file data
DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*--- Internal table to hold Matetrial descriptions
DATA: BEGIN OF IT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- Internal to hold the records in the text file
DATA : BEGIN OF IT_DATA OCCURS 100,
WERKS(4), " Plant
MTART(4), " Material type
MATNR(18), " Material number
MATKL(9) , " Material group
MBRSH(1), " Industry sector
MEINS(3), " Base unit of measure
GEWEI(3), " Weight Unit
SPART(2), " Division
EKGRP(3), " Purchasing group
VPRSV(1), " Price control indicator
STPRS(12), " Standard price
PEINH(3), " Price unit
SPRAS(2), " Language key
MAKTX(40), " Material description
END OF IT_DATA.
* SELECTION SCREEN. *
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File
'C:\Material_master.XLS'.
PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK SCR1.
* AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
* START-OF-SELECTION
START-OF-SELECTION.
*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
* END OF SELECTION. *
END-OF-SELECTION.
*--- Perform to upload Material Master data
PERFORM UPLOAD_MATMAS.
* Form : validate_input_file
* Description : To provide F4 help for file if read from PC
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
ENDIF.
ENDFORM. " validate_input_file
*& Form CONVER_XLS_ITAB
* text
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ENDFORM. " CONVERT_XLS_ITAB
*& Form MOVE_DATA
* text
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO <FS>.
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form DELETE_HEADER_EMPTY_RECS
* To delete the Header and empty records
FORM DELETE_HEADER_EMPTY_RECS.
DATA: LV_TABIX LIKE SY-TABIX.
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
* P_HEADER = 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.
*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
V_EMPTY = V_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.
*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES V_TOTAL.
IF V_TOTAL = 0.
MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
F_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS
*& Form UPLOAD_MATMAS
* to upload Material Master data
FORM UPLOAD_MATMAS .
LOOP AT IT_DATA.
* Header
UNPACK IT_DATA-MATNR TO IT_DATA-MATNR.
BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
* Material Description
REFRESH IT_MAKT.
IT_MAKT-LANGU = IT_DATA-SPRAS.
IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
APPEND IT_MAKT.
* Client Data - Basic
BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
BAPI_MARA1-DIVISION = IT_DATA-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
* Plant - Purchasing
BAPI_MARC1-PLANT = IT_DATA-WERKS.
BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
BAPI_MARCX-PLANT = IT_DATA-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
* Accounting
BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.
BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
*--- BAPI to create material
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA = BAPI_MBEW1
* VALUATIONDATAX = BAPI_MBEWX
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA = BAPI_MVKE1
* SALESDATAX = BAPI_MVKEX
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = IT_MAKT
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-MATNR.
ELSEIF BAPI_RETURN-TYPE = 'S'.
WRITE: 'Successfully created material' ,IT_DATA-MATNR.
ENDIF.
ENDLOOP.
ENDFORM. " UPLOAD_MATMAS
Regards,
V.Balaji
Reward if Usefull... -
How to call external files from java?
How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?Jayarathina_Madharasan wrote:
no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
From JavaRanch :
And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
Edited by: Encephalopathic on Apr 14, 2008 10:01 AM -
Creating a DLL in Labview 8.6 and calling it from Visual Basic 6.0
Dear friends,
I need to create a DLL in Labview 8.6 and call it from Visual Basic 6.0. The system works as follows:
I made an application using Labview 8.6 + Vision Assistant 8.6 where I can obtain the x,y coordinates of a template in an certain image being captured by an USB camera. The template coordinates change every time it moves and Visual Basic 6.0 must read these x,y values in real time. I found some information in the link http://zone.ni.com/devzone/cda/tut/p/id/3925, but it works for version 6.x of Labview and 8.6 version is different. Am I in the right path? If you have an updated tutorial like the one in the link above but for Labview 8.6 It would be very nice. Please help me.
Kind regards.
João JúniorHello Osvaldo,
I analysed the updated tutorial you sent me, but the thing is that it doen't show how to create the DLL in LV 8.6 but only show how to accessing the DLL from VB6. My problem is really HOW TO CREATE THE DLL IN LV8.6. In the link http://zone.ni.com/devzone/cda/tut/p/id/3063 there is detailed information about how to do this in LV6.x, the problem is that I don't find the path Tools»Build Application or Shared Library (DLL) in LV8.6, I think the procedure in LV8.6 is a little bit different. Don´t you have an updated tutorial on how to build a dll in LV8.6?How could you help me?
Kind regards.
João Júnior -
My Face Time icon in dock does not show how many calls I have missed. It should show the number similar to the email system(a red number appears on the stamp icon). How can I rectify this problem?
Hey michelefromuk,
Thanks for using Apple Support Communities.
Mac Basics: Notifications keep you informed
http://support.apple.com/kb/ht5362
Check or uncheck "Badge app icon" option to show badges on the icon of the app in the Dock.
Have a nice day,
Mario -
How to call the Page Fragment in Page with Flow logic
Hi,
I am new to BSP, My requirement is to created 1 page fragment which contains the Logo. and to create 2 pages in flow logic
The logo has to apper in Pages with flow logic Pages. My question is how to call the PAge fragment in the 1 &2 pagesin page with flow logic
Thanks,
sureshSuresh,
There is a very enriching portal help.sap.com where you can find all basic and good documentation .
http://help.sap.com/saphelp_nw04/helpdata/en/77/8a54d7434ff34784272a3df98ab645/content.htm
the above link is from that portal.
Before asking such basic questions please at least try to find or do some research yourself.
There are standard applications like HTMLB_SAMPLES and SBSEXT_HTMLB and more for sample applications.
Regards,
Anubhav -
How to call the screen in methods could u please explain
hi,
how to call the screen in methods could u please explain clearly with exampleHI ,
CALL SCREEN - Call a screen
Basic form
CALL SCREEN scr.
Addition:
... STARTING AT x1 y1 ... ENDING AT x2 y2
Effect
Calls the screen scr; scr is the number of a screen of the main program. You use SET SCREEN 0. or LEAVE SCREEN. to define the return from the CALL screen.
Note
Please consult Data Area and Modularization Unit Organization documentation as well.
Addition
... STARTING AT x1 y1 ENDING AT x2 y2
Effect
The coordinates x1, y1 (start column and start line in the window) and x2, y2 (end column and end line in the window) define the size and position of the CALL screen ("top left - bottom right"). Besides these coordinates, you can also see the contents of the primary window, but cannot perform any action there.
Note
If "ENDING AT ..." is not specified, suitable values are substituted for x2 and y2, taking into account the size of the called screen.
Exceptions
Non-Catchable Exceptions
Cause: No further screen level (call screen); the maximum number of nested screen levels is restricted to 50 at present.
Runtime Error: DYNP_TOO_MANY_CALL_SCREENS
THX -
How to call serlvet using ftp protocal
Hai,
How to call servlet using ftp protocal . if any one having please send that program . because generic servlet will receive any protocal request .The basics are to have your Server listen to port 21.
You would then have to parse the request information to determine what is being asked for and generate an appropriate response. -
How to call that javascript file?
I developed javascript for automated pdf files. But i don't know how to call that javascript file from outside of acrobat. Kindly advice me the various way to use that script. This is for acrobat 8.0 for windows platform.
You can place Acrobat JavaScripts in various form elements, document actions, documents, and the application folder or user application folder. See the Acrobat JavaScript API Reference and Guide fo rmore information, http://www.adobe.com/devnet/acrobat/javascript.html .
From within Acrobat's JavaScript's debugging console, one can use the following code to locate the JavaScript folders used by Acrobat/Reader:
function JSInfo() {
/* define function to report JS information */
// some basic system information
console.println(app.viewerType + ' ' + app.viewerVersion + ' is running on ' + app.platform);
// user level script folder
try {
var userJS = 'User level JS folder: ' + app.getPath("user","javascript");
} catch(e) {
var userJS = "User has not defined use JS folder level scripts";
console.println(userJS);
// application level script folder
try {
var appJS = 'Application level JS folder: ' + app.getPath("app","javascript");
} catch(e) {
var appJS = "There are no defined application level JS folder level scripts";
console.println(appJS);
return;
} // end of JSInfo function
JSInfo(); // call the function -
How to call oracle function from ejb3
i'm trying to call an oracle query-function from ejb3.
The oracle function:
create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
m_sql VARCHAR2(250);
BEGIN
m_sql:='select count(thrId) from thread where secId='|| secid||'
and thrAvai='|| avai;
open cur for m_sql;
return cur;
END;
I'v tried several ways to call it,but all failed:
1. the calling code:
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");
query.setParameter(1, secId);
query.setParameter(2, avai);
return query.getSingleResult();
but i got the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
ORA-06550: row 1, col 7:
PL/SQL: Statement ignored
2. the calling code:
@SqlResultSetMapping(name = "getSecThreadCount_Mapping")
@NamedNativeQuery(name = "getSecThreadCount",
query = "{?=call getSecThreadCount(:secId,:avai)}",
resultSetMapping = "getSecThreadCount_Mapping",
hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
@QueryHint(name = "org.hibernate.readOnly", value = "true")})
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNamedQuery("getSecThreadCount");
query.setParameter("secId", secId);
query.setParameter("avai", avai);
return query.getSingleResult();
but i run into the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
Could anyone tell me how to call the function from EJB3?
Thanks.Here's a working model:
package.procedure: (created in example schema scott)
CREATE OR REPLACE package body data_pkg as
type c_refcursor is ref cursor;
-- function that return all emps of a certain dept
function getEmployees ( p_deptId in number
return c_refcursor
is
l_refcursor c_refcursor;
begin
open l_refcursor
for
select e.empno as emp_id
, e.ename as emp_name
, e.job as emp_job
, e.hiredate as emp_hiredate
from emp e
where e.DEPTNO = p_deptId;
return l_refcursor;
end getEmployees;
end data_pkg;
/entity class:
package net.app.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@SuppressWarnings("serial")
@Entity
@Table (name="emp")
@SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
@NamedNativeQuery( name = "getEmpsByDeptId"
, query = "{ ? = call data_pkg.getEmployees(?)}"
, resultClass = Employee.class
, hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
, @QueryHint(name = "org.hibernate.readOnly", value = "true")
public class Employee implements Serializable
@Id
@Column(name="emp_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
private int id;
@Column(name="emp_name")
private String name;
@Column(name="emp_job")
private String job;
@Column(name="emp_hiredate")
private Date hiredate;
// constructor
public Employee (){}
// getters and setters
public int getId()
return id;
etc...session bean:
package net.app.entity;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
@Stateless
public class ScottAdminImpl implements ScottAdmin
@PersistenceContext
private EntityManager entityManager;
@SuppressWarnings("unchecked")
public List<Employee> getEmployeesByDeptId(int deptId)
ArrayList<Employee> empList;
try
Query query = entityManager.createNamedQuery("getEmpsByDeptId");
query.setParameter(1, deptId);
empList = (ArrayList<Employee>) query.getResultList();
return empList;
catch (Exception e)
e.printStackTrace(System.out);
return null;
}client:
package net.app.client;
import java.util.List;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
public class ScottClient
public static void main(String[] args)
try
// create local interface
InitialContext ctx = new InitialContext();
ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
// select employees by deptno
int deptno = 20;
List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
// output
System.out.println("Listing employees:");
for (Employee emp : empList)
System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
catch (NamingException e)
e.printStackTrace(System.out);
}Basically you just ignore the refcursor outbound parameter.
This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
Edited by: _Locutus on Apr 2, 2009 2:37 PM -
How to call a function of a dll
Hello,
I have to call a function from a dll. I have a description how to do that in Visual Basic but I don't find those command in Diadem 9.1.
Here is the command in Visual Basic:
Declare Sub oLIC Lib "LICENSE.DLL" (ByVal PrgNam As String, ByVal VerString As String)
PrgNam = "DiademScript"
VerString = "1.0.0"
Call oLIC(PrgNam,VerString)
Is such a call possible in Diadem?
Regards
PatrickHello Patrick!
This is not possible! This is one of the differences between VB/VBA and VBS. You have to wrap the DLL with a COM server or a DIAdem GPI DLL.
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater? -
How to call a method written in user control (ascx file) from javascript
Hi to All,
I have one scenario where I need to call a method written in user control (.ascx.cs file) from javascript (ascx file). I tried below code but it is not working, I found later it works only for aspx or asmx file , is it true ??
Code:
$.ajax({
type: "POST",
url: "ViewSearch/SetServerSessionText",
data: "{'name':'" + searchText + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function () {
alert("error");
Can anyone please tell me how to call ascx.cs code from javascript ??
Thanks in Advance !!!yes that is true, ajax calls can only be made to an endpoint like aspx pages/web service, basically anything that can return a http response etc. User Control can be embedded inside of aspx pages.
Maybe you are looking for
-
ALV Report to display the status of the requests raised through ESS
Hi All, We have to develop a ALV report to display the status of the requests raised through ESS for Leave, Travel & Event Management, Travel and Appraisal workflows. ESS Travel, ESS TEM, ESS Apraisal workflows are associted with SAP Business Objects
-
^^^^^^^^
-
How to get start with FI module(functional)
Hello, I want to know how to start with functionally on FI module
-
How do I print from the Acrobat website?
I can't find a way to print from Acrobat. Does anyone know how?
-
How to know when invoke bytecode implements?
I've got a classfile - it has few invokeinterface bytecodes inside - their count is defined dynamically - when class is running. And I've got a program, which runs this class. The aim of this program - to gather statistics of invokeinterface calling