Basic TableUI element to Retrieve Data from DB in WEbDynPro For Java
Hi Experts,
I am new to WebDynPro for java.Can any body please help me out from this issue.
I am trying to display records from DataBase by Using Table UI element.
DBTable Contains 10 rows.
I have created a Node and Attributes(for every column) .
I am using JDBC code to retrieve data from database and assigning to Attributes.
But in Table UIElement its displaying only last record from database as first row in UIElement.
Its over writing previous rows.
Can any body please help me the correct procedure to retrieve data from DataBase.
Thanks and Regards,
Shashikiran.B
Hi,
Iterate through the result set object
populate the context node
Ex:Replace the context nodeName with that of yours.
ResultSet resultSet = stmt.getResultSet();
//Iterate through the resultset
while(resultSet.next())
//Create element of the context node
IWDNodeElement nodeElement = wdContext.nodeOrders().createElement();
//assign value from the database to the context attribute
//Replace attributeName with your attribute name
//Replace value with resultSet.getShort("<ColumnName>")
nodeElement.setAttributeValue(attributeName, value);
//Add the element to your node
wdContext.nodeOrders().addElement(nodeElement);
Regards
Ayyapparaj
Similar Messages
-
Basic TableUI element to Reset Data in WEbDynPro For Java
Hi Experts,
I am new to webdynPro for java . Can anybody plz help me out.
i wrote the following code to retrieve data from DB. which is working very much fine.
public void
onActionGetRecords(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
while(rs.next()){
tabstrip.comp.wdp.IPrivateSearchEmployee.IEmpDetailsElement elt= wdContext.nodeEmpDetails().createEmpDetailsElement();
elt.setSNo(rs.getString(1));
elt.setName(rs.getString(2));
elt.setPlatform(rs.getString(3));
elt.setPhNo(rs.getString(4));
elt.setCity(rs.getString(5));
wdContext.nodeEmpDetails().addElement(elt);
Now my problem is when i call this action its adding the rows to Table UI elements.
Can anybody please help
how to reset values in TableUI element when i click on reset button OR when i call onActionGetRecords(-----) methods,
Please help me .....
thanks and Regards,
Shashikiranhi,
if you want the data to be erased(reset)
in your code
tabstrip.comp.wdp.IPrivateSearchEmployee.IEmpDetailsElement elt= wdContext.nodeEmpDetails().createEmpDetailsElement();
elt.setName("");
elt.setPlatform("");
elt.setCity("");
wdContext.nodeEmpDetails().addElement(elt);
by this way you can reset all the values present in the table
and can you make it more clear for on action getrecords
or you acn use the remove method to remove the table element
wdContext.nodeXXX().removeElement();
thanks and regards
fazal
Edited by: fazal ahamed on Apr 2, 2008 4:10 PM -
Post Author: johnnighter
CA Forum: Data Connectivity and SQL
Hi,Good Day !I followed crxi_java_bean_data_source.pdf to setup and configure Crystal Report XI (Product Version 11.0.0.1282, CR Developer; Product Type: Full).Below is the sample code.import java.sql.*;public class CRSampleDataSourceBean { private ResultSet resultSet = null; private Connection connection = null; private String connectionURL = "jdbc:derby:MyDatabase"; private String databaseClass = "org.apache.derby.jdbc.EmbeddedDriver"; private String query = "SELECT * FROM CUSTOMER"; public CRSampleDataSourceBean() { try { Class.forName(databaseClass); connection = DriverManager.getConnection(connectionURL, "", ""); } catch (ClassNotFoundException ex) { System.out.println("Ensure that database driver class is installed."); ex.printStackTrace(); } catch (SQLException ex) { System.out.println("SQL Exception #" + ex.getErrorCode() + " : " + ex.getLocalizedMessage()); ex.printStackTrace(); } } public ResultSet getResultSet() throws SQLException { Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); resultSet = statement.executeQuery(query); return resultSet; }}Compile no error. It display at the "Java Beans Connectivity" screen, and able to select from the "Java Bean Classes" combobox.It display at the "Available Data Sources" (left hand side) with database name CRSampleDataSourceBean->getResultSet. BUT when click the ">" or ">>" button, it display an error message "Failed to retrieve data from the database. Details: java.lang.reflect.InvacationTargetException". Please advice. regards,johnnighterPost Author: pvierheilig
CA Forum: Crystal Reports
Have you been able to resolve this yet? I don't have any reference to Oracle error codes but would suspect a quick Google of something like 'Oracle error code 997' should result in good information, since it is an Oracle error...
Hope this helps. -
How to retrieve data from excel sheet
Hi,
How to retrieve data from excel sheet into a java file.janu05 wrote:
If we append a $ in the end of the table name it is showing an error saying "invalid name,should not contain any invalid character or punctuation"Great, I'm very happy for you.
Unless that was a question. In which case you might what to tell us a little more.
Like which API you are using (assuming we are still on "reading an Excel sheet". -
Try to retrieve data from database got error message
Try to retrieve data from database got error message *"java.lang.ArrayIndexOutOfBoundsException: 2*
* sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(JdbcOdbcPreparedStatement.java:1023)*
* sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedStatement.java:811)*
* guestbk.doGet(guestbk.java:32)*
* guestbk.doPost(guestbk.java:73)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:710)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:803)"*
I have used prepared statment
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yy");
java.util.Date dt = sdf.parse(str3);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:gbook");
//Statement stmt=con.createStatement();
PreparedStatement ps = con.prepareStatement("SELECT * from gbook where emailid =? AND date =?");
ps.setString(1,str1);
ps.setString(2,str2);
ps.setDate(3,new java.sql.Date(dt.getTime()));
//ps.executeQuery();
//ResultSet rs=stmt.executeQuery("select * from gbook where emailid = str1");
ResultSet rs = ps.executeQuery();
out.println("<Html>");
out.println("<Head>");
out.println("<Title>GuestBook</Title>");
out.println("</Head>");
out.println("<Table border=1 align=center >");
out.println("<H4><B><center>Teacher's Lesson Plan</center></B></H4><BR>");
out.println("<TR><TD><b>Teacher Name</b></TD><TD><b>Class</b></TD></TR>");
while(rs.next())
ctr++;
String email=rs.getString("emailid");
String cmt=rs.getString("comment");
out.println("<TR><TD>"+email+"</TD><TD>"+cmt+"</TD></TR>");
}Please anybody help .PreparedStatement ps = con.prepareStatement("SELECT * from gbook where emailid =? AND date =?");
ps.setString(1,str1);
ps.setString(2,str2);
ps.setDate(3,new java.sql.Date(dt.getTime()));Your SQL query has 2 placeholders but you try to set 3 values.
And didn't you read the stack trace?
guestbk.doGet(guestbk.java:32)You could've tracked down line 32 and seen what was there at that line.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
---------------------------------------------------------------- -
Problem while executing app for retrieving data from EXCEL Sheet
hi
i have this exception while running my application of retrieving data from a Excel sheet through java application , i had also set theclasspath for jxl. jar file but where its going wrong i dont know heres my code
import java.util.Date;
import java.io.*;
import jxl.*;
import javax.swing.*;
import java.awt.*;
import jxl.read.biff.BiffException;
public class testExcel2
public static void main(String args[]) throws jxl.read.biff.BiffException
try
File f=new File("move.xls");
jxl.Workbook workbook=null;
jxl.Sheet sheet=null;
workbook=jxl.Workbook.getWorkbook(f);
sheet=workbook.getSheet(0);
Cell a1 = sheet.getCell(0,0);
String stringa1 = a1.getContents();
System.out.println("stringshaddddddddjk "+stringa1);
workbook.close();
}catch(IOException ex){
System.out.println("Error" + ex);
catch (BiffException ex2){
System.out.println("Error" + ex2);
catch(IndexOutOfBoundsException ex1){
System.out.println("Error" + ex1);
compilation is sucees but while running its giving an EXCeption
MicrosoftXP[Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
G:\mysfw\pgms>java testexcel2
Exception in thread "main" java.lang.NoClassDefFoundError: testexcel2 (wrong nam
e: testExcel2)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)Java is case sensitive. testexcel2 is different from testExcel2.
G:\mysfw\pgms>java testexcel2
Exception in thread "main" java.lang.NoClassDefFoundError: testexcel2 (wrong name: testExcel2) -
How to access(connect) BI Data in webdynpro for java applications
Hi ,
is there any way to access and display the BI data in portal using webdynpro for java applications like we did in Visual composer.
if not how to integrate the BI data in webdynpro applications ?
Regards,
GovinduHi,
Yes there are ways to do it. But may your scenario and the scenario for which I have done may differ.
You can use openhub to get the data in a flat file and then read it into weddynpro through a java service OR
You can use DBlink(which i have done).
Please refer the link below:
[Link|Data from BW to Oracle.;
This I have done in NW04s. Not sure whether a better solution is available in the newer release.
Hope it helps.
Regards,
Manoj -
Retrieve data from a dynamic page via loadURL
Hello.
I would like to ask you how it is possible to retrieve data
from a dynamic page (asp classic in my case) using the loadURL
method.
I would like to create an html authentication form (with
username and password fields). The loadURL method should call an
asp page and then pass to the usual function 'DoIfSucceded' the
results of the elaboration.
Of course I'm going to have a switch in the function in order
to make different actions depending from the results of the asp
page (authentication succeded or failed).
I had a look to the examples at this page:
Adobe
samples
Is there anyone who can explain clearly how the results data
must be written by the asp page and how the success function can
retrieve them ?
I thank you in advance for your help.loadURL() uses the the XMLHttpRequest Object so if the
content you return is XML, you have 2 choices for accessing your
data. You can either access it as a text string via the
XMLHttpRequest object's responseText property, or as a DOM document
via the XMLHttpRequest object's responseXML property:
function MySuccessCallback(req)
// If my data is XML, I can access the data that was sent
from the server
// as DOM elements via the XMLHttpRequest's responseXML
property.
var xmlDOM = req.xhRequest.responseXML;
// OR, you can access the data sent back from the server as
text via
// the XMLHttpRequest object's responseText property.
var xmlAsAString = req.xhRequest.responseText;
var req = Spry.Utils.loadURL("GET",
"/app/book.php?id=1&code=54321", true, MySuccessCallback);
If your serverside script wants to use some other format as a
response like JSON or plain text, then you can only access the data
as text via the responseText property.
--== Kin ==-- -
DO Web Service allow you to retrieve data from database and make it pluggab
Can Web Services allo you to retrieve data from the database and do they make the pluggable by allow you to plug them into any database.. how is that possible....
Going through the javaee tutorial is one sure way of accelerating your learning curve, as almost every basic you will need to get your job done is explaiined well in there. i have been using it to learn building enterprise application and is awesome good resource.
seriously consider downloading it
java.sun.com/javaee/5/docs/tutorial/doc/ -
Failed to retrieve data from the database Database Vendor Code: 2812
Hi everyone
Im using Sap Business One Version 2007A SP00 PL49, SQL 2005 and Crystal Reports Basic for Sap Business One (Add on 2.0.0.7). Whenever i try to generate a report from SBO the system displays the following message "Failed to retrieve data from the database DETAILS: [Database Vendor Code: 2812]"
The scenario is that, according to the Colombia's product local expert, Is not possible to create Stored Procedures, Views, Functions or anything in the customer productive database, in order to improve the performance of the query i created other DB where i created an stored procedure, after that, i called it from Crystal where it's working ok. But when i try to generate it from SBO it show the message promted.
Someone knows what could be happening
I'll be thankfulHi Cesar,
Please post your question to the Business One forum.
I can't move this thread.
Thank you
Don -
Crystal Add on Failed to retrieve data from the DB Vendor Code: 2812
Hi everyone
Im using Sap Business One Version 2007A SP00 PL49, SQL 2005 and Crystal Reports Basic for Sap Business One (Add on 2.0.0.7). Whenever i try to generate a report from SBO the system displays the following message "Failed to retrieve data from the database DETAILS: Database Vendor Code: 2812"
The scenario is that, according to the Colombia's product local expert, Is not possible to create Stored Procedures, Views, Functions or anything in the customer productive database, in order to improve the performance of the query i created other DB where i created an stored procedure, after that, i called it from Crystal where it's working ok. But when i try to generate it from SBO it show the message promted.
Someone knows what could be happening
I'll be thankfulHi everyone
My Stored Procedure contains the following code "annar.dbo.OIBT c", where Annar is the database name.
When i execute the report in Crystal directly is working without Issues, There everything is ok, the Stored Procedure parameters, sorts, cross tab. When i try to executed it from SBO it shows the prompt error.
The connection was OLE DB (ADO). I created an ODBC connection with the following settings
- SQL autentication based on Id and password created by user, in this case sa
- "Use Identifiers between "" ANSI " and "Use Null, filled and ANSI warning " are ticked.
- Execute character data conversion.
Microsoft SQL Native Client Versión 09.00.1399
Nombre del origen de datos: Bisynf
Descripción del origen de datos: BisynfDW
Servidor: BISYNFGER
Usar seguridad integrada: No
Base de datos: (Default)
Idioma: (Default)
Cifrado de datos: No
Certificado de servidor de confianza: No
Multiple Active Result Sets (MARS): No
Realizar conversión de los datos de caracteres: Yes
Registrar consultas de larga ejecución: No
Estadísticas del controlador de registro: No
Usar configuración regional: No
Usar identificadores entrecomillados ANSI: Yes
Usar nulos, rellenos y advertencias ANSI: Yes
Right now with Those setting is running ok again in Crystal Reports but when i try to execute from SBO the error has changed the error now is "connection could not be opened", Report Name in this case "Informe Stock Total" { 1D2DBDC5-41DE-43C0-A23C-391E7AEF2A37}.rpt
Tks a lot -
Dynamic parameter - Failed to retrieve data from the database
I'm running a report with dynamic parameters and this report ran successfully for 2 days . For no apparent reason they stopped and the error message was received. There was no interference from head office soI'm at a loss to explain why the viewer / reports suddenly stopped working.
Now I get the following message:
Prompting failed with the following error message:
'List of values failure: fail to get values. Cause of error: Failed to retrieve data from the database. Error in file UNKNOWN.RPT: Failed to retrieve data from the database.'
Error source: prompt.dll Error code: 0x8004380D
The report is running on a Oracle database using CR-Viewer XI Product version 12.01.1.r228_v20071114
I know there is a problem with dynamic parameters and citrix, but this is not run on citrix.
Please help anypne
Edited by: tstegen on Sep 30, 2009 2:48 PMIs this report based or Enterprise based LOV?
If you have report published to BOEnterprise, then it automatically creates a chain of objects for any dynamic parameter:
Data Connection,
Data Foundation,
Business View,
Business Element
and LOV.
Each of this objects have configurations like users rights, permissions and some have logon configuration. Failing any of those elements may cause LOV to fail.
One of the tests you may try is to test relevant Business View by connecting Crystal reports to it.
Are you familiar with Business View Manager? -
Re: Retrieving data from the check box group.....
Hi all,
I am new to webdynpro Java. I'm facing a problem while retrieving data from the check box group..
I've taken a simple type "Status" and Node with value attribute named status and set the property of that attribute as the simple type. This attribute is bound to the checkboxgroup.The cardinality of the Node is 0..n
But i am unable to read the checked items of the group.
Please help me out in solving my problem........Hi,
Use the following
for (int x=0; x< wdContext.nodeTest().size(); x++)
if( wdContext.nodeTest().isMultiSelected(x) )
// Selected Element
IWDNodeElement nodeElement = wdContext.nodeTest().getElementAt(x);
nodeElement.setAttributeValue("<Your Attribute> ", <Value>);
//Ex setting value for attribute called Name
nodeElement.setAttributeValue("Name", "Test");
Regards
Ayyapparaj -
Is there a way to retrieve data from a water damaged ipod?
my ipod got water on the inside, and it wont charge. when i plug it in, the image shows it as charging but its not. im guessing that there is a short circuit, do to he water. is there a way to retrieve data from my ipod?
http://www.google.com/search?client=safari&rls=en&q=svae+data+from+water+damaged +iphone&ie=UTF-8&oe=UTF-8#hl=en&client=safari&rls=en&sa=X&ei=Wwy6TtCXG-n22gX-6t2 8Bw&ved=0CCEQvwUoAQ&q=save+data+from+water+damaged+iphone&spell=1&bav=on.2,or.r_ gc.r_pw.,cf.osb&fp=bd3772843da9910d&biw=1074&bih=704
Basic troubleshooting steps
17" 2.2GHz i7 Quad-Core MacBook Pro 8G RAM 750G HD + OCZ Vertex 3 SSD Boot HD
Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
In Memory of Steve Jobs -
Retrieve data from MS Access database.
Hi all,
The following is part of my coding. Once I have clicked the jButton1, the jTextField1 will get the input of user and store into a variable named "bbb". After that the variable will be passed to a function as a parameter to retrieve data from MS Access database using the ResultSet method. Next, the ResultSet will be splited into many part and just the student ic will be displayed.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String bbb = jTextField1.getText(); //get input from user and store into a variable named bbb
ResultSet codes = getCodes(bbb); //Retrieve data from database
Code c = getCode (codes); //split the retireved date to many part
jLabel2.setText(c.ic); //display the student ic only
private static ResultSet getCodes(String bbb)
Connection con = getConnection();
try
Statement s = con.createStatement();
String select = "SELECT [Student-File].* " + "FROM [Student-File] WHERE (([Student-File].[student-code])=bbb); " ;
ResultSet rows;
rows = s.executeQuery(select);
return rows;
catch (SQLException e)
System.out.println(e.getMessage());
return null;
private static Code getCode (ResultSet codes)
try
String name = codes.getString("student-name");
String scode = codes.getString("student-code");
String ic = codes.getString ("student-ic");
String add = codes.getString ("student-address");
String phone = codes.getString ("student-phone");
return new Code (name,scode,ic,add,phone);
catch (SQLException e)
System.out.println(e.getMessage());
return null;
private static class Code
public String name ;
public String scode ;
public String ic ;
public String add;
public String phone;
public Code (String name, String scode, String ic,String add,String phone)
this.name = name;
this.scode = scode;
this.ic = ic;
this.add = add;
this.phone = phone;
}But after I have compiled the coding above, the following error existed.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
at testing3.getCode(testing3.java:137)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
at testing3.jButton1ActionPerformed(testing3.java:71)
at testing3.access$000(testing3.java:17)
at testing3$1.actionPerformed(testing3.java:45)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at testing3.getCode(testing3.java:137)
at testing3.jButton1ActionPerformed(testing3.java:71)
at testing3.access$000(testing3.java:17)
at testing3$1.actionPerformed(testing3.java:45)
My questions here are:
1) Will my idea above work?
2) Is it correct of my query statement that send to MS Access database?
Can anyone help me?
Thanks in advance,
ning.you may try this:
String select = "SELECT * FROM your_table_name WHERE your_column_name = '" + bbb + "'";or another approach using PreparedStatement:
String select = "SELECT * FROM your_table_name WHERE your_column_name = ?";
PreparedStatement ps = con.prepareStatement(select);
ps.setString(1, "bbb");
ResultSet rs = ps.executeQuery();hth.
Maybe you are looking for
-
March 2015 TechNet Guru Awards! See who's boss in FIM! It could be YOU!
The results for March's TechNet Guru competition were posted! http://blogs.technet.com/b/wikininjas/archive/2015/04/17/the-microsoft-technet-guru-awards-march-2015.aspx Below is a summary of the medal winners for December. The last column being a few
-
Vendor - Tax deduction at lower rate - MIRO & FB60
Hi all, Currently we are having one issue of u201CTax deduction at lower rateu201D for a Vendor who is having such certificate with him. For amount purpose we have set the SPRO setting but the user is asking for the date control also since the Vendor
-
Is it hard to add a link to a web page within a Java text scroller? Can I do it within a parameter tag (I would doubt that but I'm hoping) or does it have to be within the java source? Thank you!
-
Unexpected error.(WIJ 20002) in webi in infoview
hi all, When ever I am runnig a WebI report it used to run for some time and after that gives an error message that "Unexpected error. If you cannot reconnect to the server, close Web Intelligence and start again. (WIJ 20002)" https:/server/Analyt
-
Can I have Recovery and HP Tools in the same partition?
My HP originally came with 4 partitions. However, I needed one parition to install Ubuntu. Therefore I deleted the HP Tools partition since I backed up the HP Tools files and knew I could get another copy from HP. However, I would like to know if it