Return array of chars
hi, i'm from Brasil.
i make a code which use JNI and call a function in C. The function in C print all oppeneds window's names.
but i want whick the function in C return array of char with the names of the windows.
//code in java
public class WindowList {
private native void listAllWindows();
public static void main(String[] args) {
WindowList wl = new WindowList();
wl.listAllWindows();
static{
System.loadLibrary("WindowList");
//code in C
#include <windows.h>
#include <stdio.h>
#include "WindowList.h"
JNIEXPORT void JNICALL Java_WindowList_listAllWindows(JNIEnv *env, jobject obj)
char vetor[50][256]; //i want return this array.
int i = 0;
HWND janela = NULL;
janela = GetDesktopWindow();
janela = GetWindow(janela, GW_CHILD);
while(janela != NULL){
if(IsWindowVisible(janela)){
SendMessage(janela,WM_GETTEXT,256,(LPARAM)vetor);
printf("%s\n", vetor[i]);
i++;
janela = GetWindow(janela, GW_HWNDNEXT);
how return the array of chars?
souarte wrote:
but i want whick the function in C return array of char with the names of the windows. I doubt that.
What you want is to return an array of strings.
Conceptually it is the same as if you were doing it in java.
- Get a size
- Create the array with that size
- Iterate through the array and for each index...
....-Create a string with data
....-Assign to the array.
Naturally it is going to take a lot more code to do this in C than in java.
Similar Messages
-
Returning array of char with NewStringUTF
�Can anybody tell me how NewStringUTF creates a java string from an array of characters? �It stops when he founds a null character on the array or not? I dont want return the whole array but only the first significants characters.
Thanks in advance.!!PLEASE HELP!!
NewStringUtf returns more characters than expected
#define MAX_RCV_BUF 1920
char sendbuf,rcvbuf;
char devuelve[1920];
rcvbuf = (char *)tpalloc("X_OCTET", NULL, MAX_RCV_BUF)
/** (Im working with Tuxedo API)
memset(rcvbuf,'\0',MAX_RCV_BUF);
/**/I initialize the string to nulls so i thik i dont need put a null character later but...
strncpy(devuelve,rcvbuf,lRcvLen);
devuelve[lRcvLen]='\0';
tpfree(rcvbuf);
return (*env)->NewStringUTF(env,devuelve);
/** So NewStringUTF should return lRcvLen characters but, but it returns more!!! -
Stored Procedure: Function returns Array
I was just wondering if following scenario is possible in a stored procedure.
I have a package, which includes 4 different functions and 1 procedure. Procdure uses ref cursor to return values in my reporting tool. What I am trying to do is to write a function which takes input and return array of varchar. Something like..
Package ABC
Function student_classes (student_no in Varchar2) return [array]
begin
select class_nbr into [array]
from student_table
where student_nbr = student_no;
return [array];
end student_classes;
procedure students_info (rpt_cursor IN OUT rpt_type)
begin
OPEN rpt_cursor FOR
select
student_name,
student_nbr,
student_address,
student_classes (student_nbr) --returns array
from student_table;
end student_info; --end of procedure
end abc; --end of pacakge.
I used [array], as I am ont sure how to define (syntax) it in spec part of package or in body. I will really appreciate if someone could help me with this function.
Thank youThanks for the reply Tonguc Y.
I declared an array in my package declaration
CREATE OR REPLACE PACKAGE rpt_TESTING_pkg
AS TYPE rpt_type IS REF CURSOR;
TYPE DIAGARRAY IS VARRAY(20) OF VARCHAR2(6);
FUNCTION DIA_CODES (MNO IN VARCHAR2) RETURN DIAGARRAY;
PROCEDURE member (rpt_cursor IN OUT rpt_type);
END rpt_TESTING_pkg;
but then when I try to use it in my function it gives me error that I should declare DIAGARRAY.
CREATE OR REPLACE PACKAGE BODY rpt_TESTING_pkg
as
FUNCTION DIA_CODES (MNO IN VARCHAR2)
RETURN DIGARRAY AS diags DIGARRAY;
begin
<sql block>
end dia_codes;
end rpt_TESTING_pkg;
Any suggestions. -
SOAP Webservice returns Array - how to setup Xcelsius?
Hello,
after a lot of tests I have recognized that Xcelsius is not able to handle Webservices which return arrays with an undefined size. So I edited the schema file in the way that the size is defined.
Here is an extract of the schema file:
<xsd:sequence>
<xsd:element name="row0" type="tns:Row" maxOccurs="10" minOccurs="10" ></xsd:element>
</xsd:sequence>
With that configuration Xcelsius is able to import the wsdl. But the preview window is showing only one Row Folder, I have excpected "10". My question is, is my config the right way to handle arrays with Xcelsius and when it is, how I have to set up the range in the Excel Map to make the data avaiable???
Thank you in advance.
Best regards,
ConradHere is an example, you can compare what is different. From the look of it the recipient info is missing from yours. Does it say which INI option is missing when you get an error?
<doPublishRequest xsi:type="doPublishReq_Import" xmlns="http://webservices.docucorp.com/ewps/schema/2005-12-01">
<LibraryId>CONFIGNAME</LibraryId>
<DistributionOptions xsi:type="DistributionOptions_ADHOC" source="ADHOC">
<Priority>REALTIME</Priority>
<Channel xsi:type="Channel_IMMEDIATE">
<PublishType>PDF</PublishType>
<DistributionType>IMMEDIATE</DistributionType>
<Disposition location="ATTACH" />
<Recipient name="ORIGINAL">
<Props>
<Prop name="" />
</Props>
<Copies />
<Story StoryName="" id="" alias="" />
</Recipient>
</Channel>
</DistributionOptions>
<SourceType>IMPORT</SourceType>
<Import>
<ImportFile xsi:type="ImportFile_ATTACH" d6p1:contentType="" location="ATTACH" xmlns:d6p1="http://www.w3.org/2005/05/xmlmime">O05hdXRpbH.......</ImportFile>
</Import>
</doPublishRequest> -
Invoking stored procedure that returns array(oracle object type) as output
Hi,
We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
JPA Class:
import java.io.Serializable;
import java.sql.Array;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.eclipse.persistence.annotations.Direction;
import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
import org.eclipse.persistence.annotations.StoredProcedureParameter;
* The persistent class for the MessagePublish database table.
@Entity
@NamedStoredProcedureQuery(name="GetTeamMembersDetails",
procedureName="team_emp_maintenance_pkg.get_user_team_roles",
resultClass=TeamMembersDetails.class,
returnsResultSet=true,
parameters={
@StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
@StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
@StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
@StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
public class TeamMembersDetails implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long userId;
private List<TeamMembersDetailsOT> teamMembersDetailsOT;
public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
this.teamMembersDetailsOT = teamMembersDetailsOT;
public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
return teamMembersDetailsOT;
Procedure
PROCEDURE get_user_team_roles (
i_user_id IN ue_user.user_id%TYPE
, o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
, i_debugmode IN NUMBER :=0)
AS
OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.A few things.
You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
James : http://www.eclipselink.org -
URGENT HELP::: returning array of non built in datatypes
Folks,
I am trying to implement webservices in weblogic7.0 sp2. We have written a simple
class(say ClassA) which uses another bean as a user defined data type(ClassB implements
serializable). I am able to create a webservice if one of the method in ClassA
returns the object of classB.I am getting an error while creating the web-services.xml
file using ant tool if same method in ClassA returns array of ClassB.It says
corresponding type is not found in the types.xml. I created types.xml using ant
tool too.
Does weblogic7.0 SP2 support returning array of objects in webservices?
Any suggestions and immediate response is highly appreciated.
Thanks,
Kamal.Bruce,
You understand the question correctly..Thanks for the help... it works now.
Thanks,
Kamal.
Bruce Stephens <[email protected]> wrote:
Hi Kamal,
If I understand your question correctly, yes, you should be able to do
this. You will need to create your own implementation of the
javax.xml.rpc.holders.Holder interface. See:
http://edocs.bea.com/wls/docs70/webserv/implement.html#1054236 for
details.
If that's not what you are asking, could you post a simple test case?
HTHs,
Bruce
BTW, for URGENT issues, please use our excellent support folks:
http://support.bea.com
[email protected]
kamal wrote:
Folks,
I am trying to implement webservices in weblogic7.0 sp2. We have writtena simple
class(say ClassA) which uses another bean as a user defined data type(ClassBimplements
serializable). I am able to create a webservice if one of the methodin ClassA
returns the object of classB.I am getting an error while creatingthe web-services.xml
file using ant tool if same method in ClassA returns array of ClassB.Itsays
corresponding type is not found in the types.xml. I created types.xmlusing ant
tool too.
Does weblogic7.0 SP2 support returning array of objects in webservices?
Any suggestions and immediate response is highly appreciated.
Thanks,
Kamal. -
Please help how to get return array from rpg program on java code?
Hi
I have created a rpg program that returns 2 parameter 1 is the id and another one is list of array, when I called this program I passed two programparameter from my java code (see the code below) but when i checked what value would be return it is returned only first value of array. how will i get all array values ?
please suggest me regarding this issues I amn't so much aware on java & AS400.
try
ProgramParameter[] parmList = new ProgramParameter[2];
AS400Text p1 = new AS400Text(10);
AS400Text p2 = new AS400Text(30);
try
parmList[0] = new ProgramParameter(10);
parmList[1] = new ProgramParameter(30);
parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
parmList[0].setInputData(p1.toBytes("Pune"));
parmList[1].setInputData(p2.toBytes(" "));
catch(Exception ex)
ProgramCall pgm = new ProgramCall(o);
pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
if (pgm.run())
byte s[] = parmList[1].getOutputData(); // HERE I got only first value of returning array.
parmList[1].getOutputDataLength();
//String sts = ((String) (new AS400Text(10,o).toBytes(s[0])));
else
AS400Message[] messageList = pgm.getMessageList();
for (int msg = 0; msg < messageList.length; msg++) {
catch(Exception ex)
AS400Message[] messageList = null;
finally
o.disconnectAllServices();
Reply With QuoteTry this :
try
ProgramParameter[] parmList = new ProgramParameter[2];
AS400Text p1 = new AS400Text(10);
AS400Text p2 = new AS400Text(30);
AS400Array arrP2 = new AS400Array(p2, 4);
try
parmList[0] = new ProgramParameter(10);
parmList[1] = new ProgramParameter(30);
parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
parmList[0].setInputData(p1.toBytes("Pune"));
parmList[1].setInputData(arrP2.toBytes({"","","",""}));
catch(Exception ex)
ProgramCall pgm = new ProgramCall(o);
pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
if (pgm.run())
Object[] objArr = (Object [])arrP2.toObject( parmList[1].getOutputData() );
for(int i =0; i<objArr.length;i++){
System.out.println( " SKU " + i +" : " + objArr.toString());
else
AS400Message[] messageList = pgm.getMessageList();
for (int msg = 0; msg < messageList.length; msg++) {
catch(Exception ex)
AS400Message[] messageList = null;
finally
o.disconnectAllServices(); -
How to return array of String to a java program.! ??
Hi All,
I am new to JNI programming. so trying with simple example. I am having one problem. I have one array of String in my Java program. I want to reverse all the elements in this array and want back this new array in the same form i.e. array of string. So how can I do this ??
Please guide me.....
The function of defination of array in my java code is
public native String[] getReverseStringArray(String[] arrString);
where as my array is like:
String[] arrStr = {"one", "two", "three", "four", "��������","�c��","�J�^�J�i"};
and I am calling function in C file like:
arrStr = employee.getReverseStringArray(arrStr);
and the function defination in my c file is
JNIEXPORT jobjectArray JNICALL
Java_Emp_getReverseStringArray (JNIEnv *env, jobject obj, jobjectArray arr)
// some code will come here......
So can anybody tell me how to do this ??
Thanx in advance...
Pandurang
[email protected]Hi,
this is quite simple. Here an example function that works like this:
JNIEXPORT jobjectArray JNICALL Java_cadagent_ugopen_UgAssembly_jni_1getStructure
(JNIEnv *env, jclass cls, jstring part)
jobjectArray retvals = NULL;
jstring j_val = NULL;
int child_count = 5;
/* initialize return array */
j_val = (*env)->NewStringUTF(env, "");
retvals = (*env)->NewObjectArray(env, child_count, (*env)->FindClass(env, "java/lang/String"), j_val);
for (i=0;i<child_count;i++)
j_val = (*env)->NewStringUTF(env, "some text");
(*env)->SetObjectArrayElement(env, retvals,i, j_val);
return retvals;
Hope this answers you question. -
Converting an array of chars to a single integer.
Hello, I have a little question that I would really appreciate if anyone could answer.
I have a year "1978" spread out in an array of chars like this:
c�r[3] // contains '8'
c�r[2] // contains '7'
c�r[1] // contains '9'
c�r[0] // contains '1'
and I would like to transform in into an integer, int �r = 1978 ,again. How can I do that?I'm not sure if that would actually work but I would just put it into a loop, I am using a long value for the total just in case it isn't only 4 digits but more than 9.
static char c[] ={'0','1','2','3','4','5','6','7','8','9'};
static long totalC = 0;
public static void main(String [] args)throws IOException{
for(int i=0;i<c.length;i++){
totalC += Integer.parseInt(String.valueOf(c[c.length-(i+1)]))* Math.pow(10,c.length-(i+1));
System.out.println(totalC);
System.out.println(totalC);
} -
public class A{
public class B{
publc C[] sample()
int i=0;
ResultSet rset = s.executeQuery("select name, id from emp ");
while(rs.next()){
name = rset.getString("nam");
id = rset.getInt("id");
c.setName(name )
c[i].setId(id)
return c[]
public class C{
// here i have getter and setter metod for name & id
When I try to return the object c[]..i am getting "cannot conver from C to C[]".
Can u pls help me, how to return array of object and how to get name and id values in other class using this array object
Thanks for ur helppublic class Starting{
public long empID;
Data data = new Data();
Value[] value;
int count = 0;
public static void executeDe(){
value = new Value[100]
try{
data.getDetails()
processDetails(value);
}catch(Exception e){e.printStackTrace();}
public static void processDetails(Value[] value){
count = data.i;
int i;
for(i=0;i<count;i++){
empID=value.getempID(); \\ here i am not getting all values..... am getting only last value of the array
public class Data{
public long empID;
public int i=0;
static Value[] value = new Value[100];
public static Value[] getDetails(){
Connection con=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@" + hostname + ":1521:" + sid, user, password);
System.out.println(" conn " + con);
System.out.println("");
Statement s=con.createStatement();
try{
ResultSet rset = s.executeQuery("select EMPID from Employee ");
while(rset.next()){
empID = rset.getLong("EMPID");
value[i].setCycleID(cy_i);
i++;
rset.close();
con.close();
}catch (SQLException sqle){sqle.printStackTrace();}
finally{
try{
s.close();
con.close();
}catch(SQLException e){e.printStackTrace();}
catch(Exception e){e.printStackTrace();}
return value;
public class Value {
public static long cycleID;
public static void setempID(long empID) {
Value.empID = empID;
public static long getempID() {
return empID;
This is my actual code..... I am able to set the values in Value class from Data class using getDetails() method, which is returning array of value object.
In Starting class, I am trying to get values using value[i].. i am getting last value of the array. This is my actual problem... here i want to get all values.
Please help me how to resolve this. -
I want to return array of unsigned integer from call library node.
If anybody knows please help me
Thanks & Regards,
Harish. G.Did you take a look at the example that ships with LabVIEW that shows how to do all sorts of data passing to DLLs. I believe your situation is one of the examples listed. You can find the example VI in the "<LabVIEW install directory>\examples\dll\data passing" directory.
-
Returning array of values from a PL/SQL stored procedure
I try to run the following example, always happen errors: Run-time error'91' Object variable or With block variable not set.(in line: Set myRS.Source = myCmd1 and Set myRS.Source = myCmd2) Who can tell me where is wrong? I check variable, all set.
Option Explicit
Dim myCnn As ADODB.Connection
Dim myCmd1 As ADODB.Command
Dim myCmd2 As ADODB.Command
Dim myRS As ADODB.Recordset
Dim myConnStr As String
Dim mySQL As String
Dim inputssn As Long
Private Sub cmdGetEveryone_Click()
Dim myLine As String
Set myRS.Source = myCmd1
myRS.Open
myLine = ""
While Not myRS.EOF
myLine = myLine & myRS.AbsolutePosition & " " & _
myRS(0) & ", " & myRS(1) & ", " & myRS(2) & vbCrLf
myRS.MoveNext
Wend
MsgBox myLine
myRS.Close
End Sub
Private Sub cmdGetOne_Click()
Set myRS.Source = myCmd2
inputssn = InputBox("Enter the SSN you wish to retrieve:")
myCmd2(0) = inputssn
myRS.Open
If myRS.RecordCount = 0 Then
MsgBox "No data found"
Else
MsgBox "Person data: " & myRS(0) & ", " & myRS(1) & ", " & myRS(2)
End If
myRS.Close
End Sub
Private Sub Form_Load()
'Using an "On-the-fly" nameless ODBC connection
'Replace <User ID>, <Password>, and <Server> with the
'appropriate parameters.
' myConnStr = "UID=*****;PWD=*****;driver=" _
' & "{Microsoft ODBC for Oracle};SERVER=dseOracle;"
' myConnStr = "UID=CSUPerson;pwd=euclid;driver={Microsoft ODBC for Oracle};SERVER=company;"
'you may also use a named connection DSN such as "myOracleODBC" as follows
myConnStr = "user id=csuperson;password=euclid;DSN=myOracleODBC;"
Set myCnn = New ADODB.Connection
With myCnn
.ConnectionString = myConnStr
.CursorLocation = adUseClient
.Open
End With
'the entry RESULTSET 99 indicates the arguments (ssn, fname, lname)
'are arrays of up to 99 cells each.
'The binding vars (ssn, fname, lname) should be retrieved in VB using a recordSet
mySQL = "{call packperson.allperson({RESULTSET 99, ssn, fname, lname})}"
Set myCmd1 = New ADODB.Command
With myCmd1
Set .ActiveConnection = myCnn
.CommandText = mySQL
.CommandType = adCmdText
End With
mySQL = "{call packperson.oneperson(?,{RESULTSET 2, ssn, fname, " _
& "lname})}"
Set myCmd2 = New ADODB.Command
With myCmd2
Set .ActiveConnection = myCnn
.CommandText = mySQL
.CommandType = adCmdText
.Parameters.Append .CreateParameter(, adInteger, adParamInput)
End With
Set myRS = New ADODB.Recordset
With myRS
.CursorType = adOpenStatic
.LockType = adLockReadOnly
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
myCnn.Close
Set myCnn = Nothing
Set myCmd1 = Nothing
Set myCmd2 = Nothing
Set myRS = Nothing
End Sub
Package:
PACKAGE packperson AS
TYPE tssn is TABLE of NUMBER(10)
INDEX BY BINARY_INTEGER;
TYPE tfname is TABLE of VARCHAR2(15)
INDEX BY BINARY_INTEGER;
TYPE tlname is TABLE of VARCHAR2(20)
INDEX BY BINARY_INTEGER;
PROCEDURE allperson
(ssn OUT tssn,
fname OUT tfname,
lname OUT tlname);
PROCEDURE oneperson
(onessn IN NUMBER,
ssn OUT tssn,
fname OUT tfname,
lname OUT tlname);
END packperson;
BODY:
PACKAGE BODY packperson
AS
PROCEDURE allperson
(ssn OUT tssn,
fname OUT tfname,
lname OUT tlname)
IS
CURSOR person_cur IS
SELECT ssn, fname, lname
FROM employee;
percount NUMBER DEFAULT 1;
BEGIN
FOR singleperson IN person_cur
LOOP
ssn(percount) := singleperson.ssn;
fname(percount) := singleperson.fname;
lname(percount) := singleperson.lname;
percount := percount + 1;
END LOOP;
END;
PROCEDURE oneperson
(onessn IN NUMBER,
ssn OUT tssn,
fname OUT tfname,
lname OUT tlname)
IS
CURSOR person_cur IS
SELECT ssn, fname, lname
FROM employee
WHERE ssn = onessn;
percount NUMBER DEFAULT 1;
BEGIN
FOR singleperson IN person_cur
LOOP
ssn(percount) := singleperson.ssn;
fname(percount) := singleperson.fname;
lname(percount) := singleperson.lname;
percount := percount + 1;
END LOOP;
END;
END;DB table:
CREATE TABLE EMPLOYEE
(FNAME VARCHAR2(15) NOT NULL,
MINIT CHAR,
LNAME VARCHAR2(15) NOT NULL,
SSN VARCHAR2(9) NOT NULL,
BDATE DATE,
ADDRESS VARCHAR2(30),
SEX CHAR,
SALARY NUMBER(10,2),
SUPERSSN VARCHAR2(9),
DNO NUMBER NOT NULL,
PRIMARY KEY(SSN));
DESC EMPLOYEE;
INSERT INTO EMPLOYEE VALUES
('John','B', 'Smith', '123456789','09-JAN-65',
'731 fONDREN, hOUSTON, TX', 'M', 30000, '333445555',5);
INSERT INTO EMPLOYEE VALUES
('Frankin','T', 'Wong', '333445555','08-DEC-55',
'683 Voss, Houston,Tx', 'M', 40000, '888665555',5);
INSERT INTO EMPLOYEE VALUES
('Alicia','J', 'Zelaya', '999887777','19-JUL-68',
'3321Castle, Spring, TX', 'F',25000 , '987654321',4);
INSERT INTO EMPLOYEE VALUES
('Jennifer','S', 'Wallace', '987654321','20-JUN-41',
'291 Berry, Bellaire, TX', 'F',43000 , '888665555',4);
INSERT INTO EMPLOYEE VALUES
('Ramesh','K', 'Narayan', '666884444','15-SEP-62',
'975 Fire Oak, Humble, TX', 'F',38000 , '333445555',5);
INSERT INTO EMPLOYEE VALUES
('Joyce','A', 'English', '453453453','31-JUL-72',
'5631 Rice,Houston,TX', 'F',25000 , '333445555',5);
INSERT INTO EMPLOYEE VALUES
('Ahmad','V', 'Jabbar', '987987987','29-MAR-69',
'980 Dallas,Houston, TX', 'M',25000 , '987654321',4);
INSERT INTO EMPLOYEE VALUES
('James','E', 'Borg', '888665555','10-NOV-37',
'450 Stone, Houston, TX', 'M',55000 , null,1);All help I will appreciat it.I can't comment on the problem returning PL/SQL arrays, but I will suggest that a more appropriate method of achieving your goal is to call a procedure which returns a REF CURSOR.
See the examples here:
http://asktom.oracle.com/~tkyte/ResultSets/index.html -
Problem returning array of strings
Hi,
I am trying to return an array of strings from C to Java.The function I am using is
char rec[20][20];
int num=0;
/* incrementing num and copying into the array everytime a record is added*/
JNIEXPORT jobjectArray JNICALL Java_jnimidlet_list_1rec
(JNIEnv *env, jobject obj)
jstring str;
jobjectArray args = 0;
jsize len = num;
int i=0;
args = (*env)->NewObjectArray(env, len,
(*env)->FindClass(env, "java/lang/String"), 0);
for( i=0; i < len; i++ )
str = (*env)->NewStringUTF( env, rec);
(*env)->SetObjectArrayElement(env, args, i, str);
return args;
In the java code:
String []all=list_rec();
when this function is called I get the error:
Unhandled exception
Type=GPF vmState=0xffffffff
ExceptionCode=0xc0000005 ExceptionAddress=0x00000000 ContextFlags=0x0001003f
Handler1=0x10f01530 Handler2=0x10026280
Module=C:\wsdd5.5\wsdd5.0\ive\bin\j9.exe
Module_base_address=0x00000000
Offset_in_DLL=0x00000000
EDI=0x0012fc14 ESI=0x10f01530 EAX=0x00020020
EBX=0x00148e34 ECX=0x0017469c EDX=0x00020020
EBP=0x00149d40 ESP=0x0012fbec EIP=0x00000000
Thread: main (priority 5) (LOCATION OF ERROR)
Thread: Gc Thread (priority 5) (daemon)
Can anyone pls tell me how do I come out of this problem.
Please help.
Thanx in advance,
pri_ravHi Priya,
I dont see any problem. I tried to work with your code it works fine without any exception. Please make sure all ur rec char buff contents are null terminated and your 'i' counter is initialized properly and stops properly. According to me there shouldn't be any problem with JVM. I hope you are aware of c programming,which doesn't check for array boundaries. You may accidentally go out of array size allocated. So my suggession is to check you rec buff going above any of the dimension. Put a watch on 'i' variable content as well. Try and let me know whether it solves your problem. If it doesn't reply me with more details. I will try helping you.
Thanks,
Regards,
Ravikiran. -
Hello All,
I defined a view in my application. This view comprises of a structure
containing an integer and char[].
I my application, I created an array of this structure and populated it.
I return the pointer to the array of the structure in the tpreturn call.
on the client side, I can see that only the first element of the array
is retrievable. The rest is junk data.
Why did the other elements did not come?
when populating the data in the array I do a userlog in the loop and I
can see that each element of the array was populated.
Why am I not able to send the entire array to the client side?
thanks for your help.
regards,
Abhishek.Abhishek,
Make sure that you are using the exact C structure that was produced by the View
compiler from your View description.
Can you post your .v file, and the .h it generated?
If you need to transmit an array of the entire structure, you can use embedded
FML32 to pack many View structures into an FML32 buffer.
If you are always sending between the same machine types and data representations,
and you don't need Routing, then you can stuff your C structure into a CARRAY
and send it that way. On the other side, you'll have to copy it out into a
properly aligned structure.
Scott Orshan
Abhishek Srivastava wrote:
Hello All,
I defined a view in my application. This view comprises of a structure
containing an integer and char[].
I my application, I created an array of this structure and populated it.
I return the pointer to the array of the structure in the tpreturn call.
on the client side, I can see that only the first element of the array
is retrievable. The rest is junk data.
Why did the other elements did not come?
when populating the data in the array I do a userlog in the loop and I
can see that each element of the array was populated.
Why am I not able to send the entire array to the client side?
thanks for your help.
regards,
Abhishek. -
Need help on returning arrays from C++ to Java
Hi all, I hava a C++ application that contains a method that will return a float array to Java. I was able to write the Java Code, the JNI code to call the C++ method and compile them successfully. However on calling the native method from Java, the data in the array returned was not what I want. Please look through my code and see what is wrong with it.
My Java Code:
public native float[] Statistics(int inputKey); // This is the native method
public float[] Stats(int k){ //Java method to call the native method so that I can use it in a Bean for a JSP.
inputKey = k;
float[] p = new float[4];
p = Statistics(inputKey);
return p;
For this native method, an integer is passed from Java to the native side and the native method will use this integer to generate a float array size of 4 and populate it with data and return it back to Java.
My JNI code
extern "C"
JNIEXPORT jfloatArray JNICALL
Java_com_jspsmart_upload_FinalWaterMark_Statistics(JNIEnv *env, jobject obj, jint inputKey)
jfloatArray floatArray = env->NewFloatArray(4); //This creates a new Java floatArray to store the C++ array
CWatermarker2App p; // This is the C++ class to be used
jfloat *stats = p.OnWatermarkStatistics(inputKey) // The C++ method returns a float pointer for an array of size 4
env->SetFloatArrayRegion(floatArray, 0 , 4 , stats); //storing the C++ float array into the Java float Array
return floatArray; // return the Array to Java
In this example, I should have the data returned as [4952.0 2529.0 1706.0 33.6] in the array.
But i am getting junk instead like 2.53E-23, 1.402E-15 etc..
Is this a type conversion mistake?
Please help!The first thing I notice - probably not the problem - is the line defining p. There is no reason to define this as an array of size 4, because the return from the native method is going to wipe that definition, replacing it with the return value of the native method. Alternatives:
1. float[] p = null.
2. float[] p = Statistics(inputKey);
3. return Statistics(k);
Maybe you are looking for
-
ITunes not connecting to Airport Express
Trying to play music through remote speakers. Get an iTunes error message stating remote speakers can't be found. The airport express is set up properly, and worked great for months. Now its not letting me play any music. The express is recognized in
-
Attachments will not work in yahoo e-mail
Have previously had no problems with this but since downloading version 4 attachments will not work so have returned to internet express where there is no problem.
-
Recently, I used the reset option in the iPhone 3G General Settings. Everything went fine. Just after that, when the iPhone restarted, it refuses to start up. It actually freezes at the "apple" screen. I tried forced restart (home + power button), co
-
I purchased Adobe Photoshop Elements 12 dvd a few months ago and never loaded it onto my computer. I have since purchased a new Macbook that does not have a dvd player. How can I get a download version without paying for this product again? Can I
-
Has anybody tried "MSI Bluetooth Driver only for WinXP SP2" with MS-6968? I wanna skip widcomm....