Record set in java
Dear Sir,
I found java tutorial so much interesting & informative .I have switch my data base programming from Microfoft Visual basic 6 to Java to make plateform independent database application .
I want to make a database application where i can move to next record set by pressing a button & also move back to see my previous recordset by using JButton.
In other language just like Visual Basic a programmer can easily do it but i do,t know how can i do same thing in SDK java2.
Sir is it possible in java database application ?
Hope soon for the reply,
Thank you,
Ali
The key is to tell the driver to use a specific type of Statement object, in particular ...TYPE_SCROLL_SENSITIVE ie:
Statement stmnt = con.createStatement(
java.sql.ResultSet.TYPE_SCROLL_SENSITIVE,
java.sql.ResultSet.CONCUR_UPDATABLE
); Then, after creating a result set from this statement, you can use the previous and next commands, as well as absolute row commands found in the ResultSet object.
However, these will not work if you do not explicitly create the special type of Statement object ie. this won't work:
Statement stmnt = con.createStatement(); Hope this helps. Not all drivers will support this.
Similar Messages
-
Using a session object to hold the value of a record set?
Hi,
I'm trying to hold the value of a record set (or literally the content of a column in a query in a db) in a session variable so that I can call on this later and insert into another table.
I'm not sure of the correct syntax, I've already made a connection to the DB. I'm trying the following but it doesnt seem to like the code:
<% session.setAttribute("code",rs("column_name")); %>
<%String attrib =
String.valueOf ( session.getAttribute("code")); %>
Hello <%= attrib %>
Any ideas, I dont know how to reference the record set, I declared the recordset previously as rs. Help! Can't find examples anywhere on the net!So just to recap. I appear to be seeing the column name "custorderno" within the Microsoft Access query "lastcust". But I get "no data found" when I run the following code (which I have sectioned off)
<!-- connect to database and lastcust query --!>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Tomcat/jakarta-tomcat-4.1.31/webapps/ROOT/Oatcake.mdb","","");
Statement statement = conn.createStatement();
String sql = "SELECT * FROM lastcust";
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
%>
<TR><TD><%= rs.getString("custorderno") %></TD>
</TR>
<% session.setAttribute("code",rs.getString("custorderno")); %>
<% String attrib =
String.valueOf ( session.getAttribute("code") ); %>
Hello <%= attrib %> [B]
<%
%>
</TABLE>
<%
if (statement != null)
statement.close();
if (conn != null)
conn.close();
catch (Exception e) {out.print(e);}
%>
</BODY>
</HTML>
No as mentioned I am (as you can see) declaring everything as a string when in actual fact the contents of the "custorderno" within the query is set to a autonumber within MS Access.
The while loop does work by returning the contents but the session object part is not working correctly with the following result returned:
[B]java.sql.SQLException: No Data Found
Help please! -
Revision: 3127
Author: [email protected]
Date: 2008-09-05 14:16:53 -0700 (Fri, 05 Sep 2008)
Log Message:
Updating asdoc to replace the avmplus call with new set of java files.
Removing all files related to asdochelper.
QA: Yes, also please test on non windows platform.
Doc:
Tests: checkintests, asdoc
Reviewed by: Pete Farland
Modified Paths:
flex/sdk/trunk/asdoc/templates/ASDoc_Config_Base.xml
flex/sdk/trunk/asdoc/templates/asdoc-util.xslt
flex/sdk/trunk/modules/compiler/build.xml
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocAPI.java
Added Paths:
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsClass.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocHelper.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/QualifiedNameInfo.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/SortComparator.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/TopLevelClassesGenerator.ja va
Removed Paths:
flex/sdk/trunk/asdoc/templates/asDocHelper
flex/sdk/trunk/asdoc/templates/asDocHelper.linux
flex/sdk/trunk/modules/compiler/asdoc/I had a generic record class that has a HashMap to hold the data fields (...)
method called createRecord() for each record type which would populate the HashMap with the correct data fieldsI'm not sure I understand: are the contents of this field map the same between two records of the same type? Then yes, you don't need to clone the map per record instance.
one thing that needs fixing is the fact that each time the createRecord() method is called I'm creating a new fieldMap to define the dataFields in the record class.Probably, but that will only get you a little bigger files; you won't gain an order of magnitude on the size of files. The problem for huge files is that as soon as their content is bigger than the available memory, you'll run into problems. A more radical approach if you need to address huge files is to process the records on the fly, and not load all records in memory. Of course not all algorithms or business logic can afford that...
I know I could rewrite the code and create a class for each record type and declare the fieldMap static but I was wondering if anyone had any better suggestions The Record instance could receive and keep a reference to its RecordType instance, and ask the RecordType instance the DataType for a field's name. That way the RecordType encapsulates the map, and there's less risk that a clumsy other class modifies the static map.
before I go rewriting a load of code.A load of code?!? Even with the idea of the static map, you only have to edit the enum type (well more accurately, each RecordType enumerated constant's createRecord() method). -
Recording a thick java client app
Can eTester record a thick java client application? I've tried using proxy but that doesn't appear to work.
James
eTester can record thick client app HTTP requests, you should use:
A external proxy recorder:
- Options -> Current Script -> Recording -> Proxy and select record navigations in a external application.
- Remove the ;application/* from the exclude statement
- Set the proxy of the thick Java app to point to, localhost on port 7777
If the thick java app is a Java Applet you will need to set the JVM to point to the porxy at locahost 7777 to do so:
- Start -> Control Panel -> Double click on Java -> under the general tab select network settings, select use proxy server and enter the proxy settings.
Happy recording !!!!
Alex
Edited by: aamat on Dec 10, 2008 9:42 AM
Edited by: aamat on Dec 10, 2008 9:43 AM -
Hi
I come from VB background and very new to java.
Is it possible to return a record set from call method like in VB?
APYes.
-
Click on J button to display record set
How to write a code to click o j button to display record set of MS Access database
http://java.sun.com/docs/books/tutorial/jdbc/index.html
Create a class to perform DB related stuff and call in when the button is clicked. Your question is too generic. It would be better if ou asked a specific query. -
How to get the record set into array?
Hi,
I want to get the record set into array in the procedure and do the processing of the array later in procedure.
below is the stored procedure i am working on:
procedure bulk_delete_group(p_group_id in Array_GroupListID) as
begin
for i in p_group_id.first..p_group_id.last loop
--Here I have to get the list of user id before deleting group
SELECT user_id into *<SOME ARRAY>* FROM group_members WHERE group_id = p_group_id(i);
DELETE group WHERE group_id = p_group_id(i);
--Process the user id array after group deletion..
end loop;
end bulk_delete_group;
Thanks in advance
AdityaSomething like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.20
satyaki>
satyaki>
satyaki>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
7777 SOURAV SLS 14-SEP-08 45000 3400 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 4450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 7000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
13 rows selected.
Elapsed: 00:00:02.37
satyaki>
satyaki>create type np is table of number;
2 /
Type created.
Elapsed: 00:00:03.32
satyaki>
satyaki>Create or Replace Procedure myProc(myArray np)
2 is
3 i number(10);
4 rec emp%rowtype;
5 Begin
6 for i in 1..myArray.count
7 loop
8 select *
9 into rec
10 from emp
11 where empno = myArray(i);
12
13 dbms_output.put_line('Employee No:'||rec.empno||' Name:'||rec.ename);
14 end loop;
15 End myProc;
16 /
Procedure created.
Elapsed: 00:00:00.88
satyaki>
satyaki>
satyaki>declare
2 v np:=np(9999,7777);
3 begin
4 myProc(v);
5 end;
6 /
Employee No:9999 Name:SATYAKI
Employee No:7777 Name:SOURAV
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.30
satyaki>Regards.
Satyaki De. -
By which method,i can get the no of rows in the record set?
Does anyone help me that by which method,i can get the no of rows in the record set?
now i use next() to check whether the next record is available or not?shashi_rajak wrote:
under Practice Exercise #1 heading :
there is a statement.
"Now, the COUNT function does not need to retrieve all of the fields from the table (ie: employee_number, employee_name, and salary), but rather whenever the condition is met, it will retrieve the numeric value of 1. Thus, increasing the performance of the SQL statement."And have you ever tried it? Or do you simply blindly believe everything you read? And what sort of "authority" is "tech on the net"?
P.S. A quick test on Oracle (and you must do each query at least twice throwing away the first result, as Oracle always caches things which will have an effect, and averaging the remaining attempts).
count(*) -- 1 min 17 secs for 35,311,978 rows
count(1) -- 1 min 19 secs for 35,311,978 rows
Edit: And the table has 46 columns. -
Parameter set in Java stack for retention of messages in PI
Hi,
Can you tel me which paramter is set in Java stack for retention of messages in adapter engine and where we can we find in Java stack?
Thanks.RWB --> Component MOnitoring --> Adapter Engine --> Background Processing
http://help.sap.com/saphelp_nwpi71/helpdata/en/05/b1b740f83db533e10000000a155106/frameset.htm -
Doubt on Record set in File Content Conversion
Hi
Please give me the procedure for Deleting record set in file conet conversion means hoe can i delete Recordset(tag) using File conent conversion.
Thankshi
<documentName>...
<recordset>
<NameA>
<field-nameA1>field-value</field-nameA1>
<field-nameA2>field-value</field-nameA2>
<field-nameA3>field-value</field-nameA3>
</NameA>
<NameB>
<field-nameB1>column-value</field-nameB1>
<field-nameB2>column-value</field-nameB2>
<field-nameB3>column-value</field-nameB3>
</NameB>
</recordset>
<recordset>
</recordset>
</documentName>...
In above file record set i want to delete usind sender side.
Thanks -
File content conversion record set per message
Dear All,
Problem:- File is of huge size because of which file content conversion is taking longer time and is failing.
File format:-
Header
Detail
Detail
Header
Detail
Detail
Detail
Detail
Header
Detail
Detail
Trailer
Trailer has total count of all detail record,header record and there are few checks as well as wrt other fields.
We need to do all the above validation on the file and if it successful it shud process it otherwise alert shud be raised.
As a step:-
I have used record set per message for splitting up the file because of huge size this functionality is working fine but because of spitting of file i am not able to do trailer validation as XI is creating multiple records with different message ID's
Is any other approch which will help to achieve both Spliting as well as validation
chiragChirag,
simplest scenario I can think of is splitting the 2 reqs.
1. create 2 folders, one for "in process" files and other for "validated" files.
2. create 2 scenarios:
2.1. your current sender system to in process folder (whatever to File).
=> In this you just do the validation, without FCC. You could create a simple module for that or even do it at mapping runtime, as you said (mapping may be easier to handle errors), and throw a runtime exception (which will eventually trigger an alert).
=> At the end, only files that go successfully throug the validation will be located in the "In Process" folder.
2.2. do a simple file to file scenario (from "In Process" to "Validated" folder), this time executing FCC & splitting messages if necessary.
Of course, this will only work if the module/mapping is able to process the large file anyway (hopefully yes, since it will still be a flat file and not XML yet).
BR,
Henrique. -
Using the follwing query
select distinct code from oalr where code > '" & AlertCode & "' and code<=('" & code & "') "
i got 5 records eg :5603,5604,5605,5606,5607
record set fetching
Ocode = CStr(rs4.Fields.Item(0).Value)
Here Ocode get only last record eg :5607, i want to take this 5 records in the loop how can i write the codingThank for ur reply,
But i not passing this in to matrix , i m going to pass the value in to anothe record set
eg
Ocode = CStr(rs4.Fields.Item(0).Value)
select A.code,A.MsgData,B.UserSign,C.Portnum as MobileNum from OALR A inner join ALT1 B on A.Tcode=B.code inner join OUSR c on C.UserID=B.UserSign where A.code='" & Trim(Ocode) & "' ")
I want to pass the Ocode value in to the loop.becoz only one value pass this query next time pass means duplicate value prob occure so i want to pass the Ocode value up to EOF. Give some solution -
Reg: When trying for [Record Set Per Message] Payload not generating MONI
Hi,
Can you please change the value of FCC parameters from
Record Set Per Message:: 1
Key Field Value: KF
Key Field Type: Case Sensitive
Record Set Per Message:: 1
Key Field Value: K01
Key Field Type: Case Sensitive
Regards,
ChandraHi,
If you want to split file according to Record set per message, check below settings with your configuration.
Ex file:
Amarsrinivas,Eli,4444,XYZ,3
Sachin,Tendulkar,29564,ABC,9
Ajay,Jadeja,5555,PQR,5
*IR PART*
See this is the Outbound Data type I have created::
*ADT_Record_Outbound Complex Type *
Record Element 0..unbounded(This is used for if Record set per message more then one.Structure Occurance.Not the message type)
First_Name Element xsd:strin 1
Last_Name Element xsd:string 1
EMP_ID Element xsd:string 1
Project_Status Element xsd:string 1
Experience Element xsd:string 1
THis is the Inboudn Data type I have created::
ADT_Record_Inbound
*ADT_Record_Inbound Complex Type *
Record Element 0..unbounded(This is used for if Record set per message more then one.Structure Occurance.Not the message type.One to one mapping done)
FullName Element xsd:string 1
Global_ID Element xsd:string 1
Project Element xsd:string 1
IT_Exp Element xsd:string 1
This is the Mapping I have done.....
ForSource Message TYpe I kep Occurancs as 1
For Target Message Type as I kept Occurances as 1
ID Part::
CONTENT CONVERSION PARAMETERS::
Document Name:: AMT_Record_Outbound
Document Namespace:: http://xxxxxxxxxxxxxxxxxxxxx
Document Offset::
RecordSet Name::Record
RecordSet Structure: ---:Record,*
Recordset Sequence,* ::: Assensding
Record Set Per Message:: (As you required)(According to that target file and message will create)(If you mention 2 each 2 structure one message will flow in SXMB_MONI)
Key Field Value:
Key Field Type: Case Sensitive
Record.fieldSeparator= ,
Record.endSeparator= nl
Record.fieldNames= First_Name,Last_Name,EMP_ID,Project_Status,Experience
ignoreRecordsetName= true
Regards,
Prakasu.M -
We're using a function to return a ref cursor back to VB.
Works great until we try and update it. As soon as we try and update the record set we're getting an error "Multi-step operation generated errors. ". It looks to us like the record set is read-only. We've tried using an in-out parameter to a procedure - same problem. However, it works fine as long as we pass the sql instead of a call to a function or procedure.
We don't really want to have to pass the sql.
Can anyone help with this ?
Thanks,
Tricia.Ref cursors that are returned to an application from a stored procedure are read-only if you're using ODBC or OLE DB. I believe that the beta .NET native provider will allow you to update returned ref cursors, however.
The reason it works when you issue straight SQL is that the driver actually modifies your SQL statement to get the ROWID's for all the rows. Then, it's able to update rows by building its own SQL insert statement.
Justin -
Can we enable "Select record Set Message choice" of Table in left side
Hi ,
I have requirement to set the "Select Record Set " Message choice of a table region on left side.
Ex:If there are more records in a table region and message choice available to select next set of records.
You can chk in Workflow Status Monitor function.
Its the Navigation Bar to be @ left side on the table Region whcih allows you to navigate the records set.
Thanks,Sarath.
Edited by: SarathL on Dec 13, 2011 4:59 PMHi,
Not sure what exactly you are looking for.
The Next link and option to select next set of rows comes to your OA Table by default .. isn't it?
-Idris
Maybe you are looking for
-
Printing problem with iPhoto 9.5 version
I have tried to print a photo today, using the Share function in iPhoto. It did not work. Epson SW438 printer fired up but proceeded to print the picture but without the paper feeding through. This is NOT a printer malfunction. I printed successfully
-
Problem with printing graphics in SAP Script
Hi, I am facing problem with printing of graphics in SAP Script. I uploaded a bitmap file from pc to se78. Then I inserted it in SAP script. I am able to view it in the printpreview as well as in the spool number. But it is not getting printed. Plese
-
Exposing content nodes as links in WLP 9.2
Hi! I am a portal 'newbie' with a POC on my hands, in which one goal is to index the content in a BEA Repository with my company's search technology. I have managed to expose the content node i'name' and 'path' properties in a simple web page, but I
-
Patch driver 6678700 taking forever
I'm using MW to upgrade a test instance of 11.5.10.2 to R12.1.1. I've manually applied patch 7461070 (The AD 12.1.1 upgrade driver) since MW won't apply it. I'm applying the American English upgrade patch driver (patch 6678700) manually. It has been
-
I tried a simple test of a mask - I created a block of text on the top layer and a rectangle with a gradient fill on the bottom layer. Made the file 30 frames long then created a motion tween on the gradient layer to 'move' the gradient behind the te