ArrayCollection to Java ArrayList to database
Hi Every bod
My MXML program sends an array collection to java method
successfully. But, how I can read in java each attribute of each
object of the java array list in order to store them?
Thanks
Best regards
Dr. Khaled
Each object in the ArrayList will be converted into an
flex.messaging.io.amf.ASObject in Java. An ASObject is basically a
java.util.Map so you can use the get method.
In ActionScript: { firstname:"George", lastname:"Washington"
becomes in Java:
obj.get("firstname");
obj.get("lastname");
Similar Messages
-
HELP! Saving a JAVA OBJECT to database...
good morning,
I use POSTGRESQL.
I wonder, is it possible to save a JAVA OBJECT (java.util.ArrayList) into
database? So I can retrieve it in the save form as before.
Thank you.http://forum.java.sun.com/thread.jsp?forum=31&thread=271751&tstart=0&trange=15
Please DO NOT SHOUT it your subject line. (Sorry.)
see wat i mean? it feels uncomfortable.
as for your question, Yes!Create a java.io.ByteArrayOutputStreamObject and wrap it with an ObjectOutputStream. Call ObjectOutputStream's writeObject method to save your object, get the array from the ByteArrrayOutputStream and save in db. Reverse the process to read. -
How to pass java arraylist into javascript arrays
Hi, i have declare an arraylist
ArrayList list1 = new ArrayList();Inside the arraylist, there are elements. Now, i wan to pass the elements in the java arraylist into javascript arrays but i encounter javascript errors.
This is how i code.
var arr1 = new Array();
<%
for ( int x =0; x<list1.size(); x++)
%>
arr1[<%=x%>] = <%=(String)list1.get(x)%>;
<%
%>how do i solve this problem?
Thanks for the guidance in advanceJTech wrote:
Hi,
Use Quotes around string value ( arr1[indexposition] = "stringvalue";), when assign to javascript array as below.
arr1[<%=x%>] = "<%=(String)list1.get(x)%>"; Regards,
Ram.Hi Ram,
How about using arr1 = <%=list.toArray()%> ??? Is this possible? I tried it but was not working on my IDE. Do you have any solutions for this??
Regards,
Thiagu -
How to pass a Java arraylist as a parameter to a StoredProcedureCall
I need to invoke a stored procedurecall which takes in a collection parameter represented as a nested table. I need to pass a java ArrayList object to it. How can I pass this parameter to the stored procedure using StoredProcedureCall class.
Hello,
Check out
Is possible to pass array/list as parameter in TopLink StoredProcedureCall?
for some more information on using VARRAYs in 10.1.3. TopLink 11 has a feature that converts VARRAYs to/from collection types for you. An example using "myProcedure" that has an inout parameter "names" defined as type "NAMELIST_TYPE" would be:
StoredProcedureCall sqlcall = new StoredProcedureCall();
sqlcall.setProcedureName("myProcedure");
sqlcall.addUnamedInOutputArgument("names", "names", Types.ARRAY, "NAMELIST_TYPE", ArrayList.class);
DataReadQuery query = new DataReadQuery();
query.addArgument("names");
query.setCall(sqlcall);
Vector args = new Vector();
ArrayList names = new ArrayList();
names.add("firstname1");
names.add("firstname2");
args.add(names);
//DataReadQuery returns a collection of DatabaseRecords
results = (Vector)getSession().executeQuery(query, args);
//getting one record from the list:
names =((ArrayList)((DatabaseRecord)results.get(0)).get("names"))This is just a simple example. More complex nested types can be done by providing a ObjectRelationalDatabaseField parameter describing the type, but I dont have any examples showing this handy.
Hope this example helps,
Chris -
How to connect Java to oracle Database Express Edition?
Anyone can help me?
How to connect JAVA TO ORACLE DATABASE EXPRESS EDITION?I suggest you to read this article:
http://wiki.oracle.com/page/JDBC
Regards,
Ricky -
How to store Java ArrayList or any Collection object
Hi,
How Can I store Java ArrayList or any Collection object into Oracle tables.
In that case what should be the Oracle datatype of that column.
Can anybody tell me in details...
Thanks in advance.
Ashok RAshok,
Search this forum's archives for ARRAY and STRUCT.
Good Luck,
Avi. -
Dear Gurus,
We are facing the below issue when performing a homogeneous system copy of NW 7.0 system using backup/restore method for DB6 system.
The Java load in database <SID>/<hostname> has not been configured yet. You cannot run an installation from the System Copy folder with this load.
We went through the SAP Note http://service.sap.com/sap/support/notes/2049842, and followed the same but no luck.
We updated the Kernel to the latest, but still no luck.
Request for your quick help as we have to complete it by EOD today.
Thanks a lot in advance.
Best Regards,
AnujHello Ashutosh ,
Thanks for your reply.
We have gone followed the below sequence:
SCS Installation
Database Instance Installation using backup/restore method
CI installation. -> getting error, when we provide the Java Components DVD.
Best Regards,
Anuj -
Linking Java to Access Database tables
Hello,
I need use JCreator to link Java to Access Database tables.
Could any one tell me what kind of drivers I need use?
Also, where could I find the examples of linking Java to Access Database tables?
Thank you,
DanielThanks.
I have read the tutorial and downloaded the sample code from the web http://java.sun.com/docs/books/tutorial/jdbc/
In the CreateCoffee.java programming, I made the following changes:
// String url = "jdbc:mySubprotocol:myDataSource";
String url = "jdbc:odbc:DB1";
DB1 is an Access Database file located in the same folder as CreateCoffee.java.
//Class.forName("myDriver.ClassName");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Every time when I run the CreateCoffee.java programming, it shows the following running error:
SQLException:[Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified.
Could any one have any suggestions for solving the above problem?
Thank you,
Daniel -
Download jar / java class from database
Hello,
I have database 10.2.0.3 with one procedure that calls some java class loaded in database. Unfortunately I don't have source code of that java class or whole jar that was loaded into database.
I would like to download it from database and try to decompile it.
Can you tell me how can I download some java classes from database?
Everything I know is only the name of some java class that is used in one PL/SQL procedure (CREATE OR REPLACE PROCEDURE ..... AS LANGUAGE JAVA)
Thanks for some tipsCan you tell me how can I download some java classes from database?You can use dbms_java.export_class procedure to export class as blob, then just save the blob to file.
-
Flex ArrayCollection to Java HashSet
Hi,
I got a problem that I cannot resolve by googleing. I need your expertise:
Here s the part of the story:
1 Bdc have many BdcDetails, so in Flex Bdc.as ==> public var bdcdetails:ArrayCollection; in Java Bdc.java ==> private Set<BdcDetails> bdcdetails = new HashSet<BdcDetails>();
It works perfectly in Flex which means Flex understand what is inside a Java HashSet. But when a Bdc is sent to Java. Java don't understand what is inside ArrayCollection, everything is ASObject. So ((BdcDetails)bdc.getBdcdetails().toArray()[0]) ==> give ClassCastException
Please help! Thanks
P/S: I am using Blaze DS 4.5.0.0-SNAPSHOTThanks, i ve found the work around.
I create a setter for Bdc.as
funtion set bdcDetails in which i loop through the arraycollection, cast
each item to BdcDetails then put back to the arraycollection.
That s it. I dont know it s good or not but it works -
How to download a java class from database to file system
Hi All,
We have one invalid java class in database. We need to verify what is the functionality of this class. So we planned to download this class to file system. Then we need decompile it to source. But we are not able to identify the right command to download the java class from database.
Please suggest me if any possible ways to acheive this.
Thanks in advance....http://www.sql.ru/forum/actualthread.aspx?tid=747308
http://download.oracle.com/docs/cd/B19306_01/java.102/b14187/appendixa.htm
PROCEDURE export_source(name VARCHAR2, schema VARCHAR2, blob BLOB)
PROCEDURE export_class(name VARCHAR2, schema VARCHAR2, blob BLOB)
PROCEDURE export_resource(name VARCHAR2, schema VARCHAR2, blob BLOB)
create table scott.t (id number, b blob);
declare
b blob;
begin
dbms_lob.createTemporary(b, true, dbms_lob.CALL);
dbms_java.export_class('sun/net/www/ParseUtil', user, b);
dbms_output.put_line('length(b): '||length(b));
insert into "SCOTT"."T" values(1,b);
end; -
CRM 2007 The Java load in database SID/hostname has already been configured.
I had an CRM 2007 system on windows server 2008R2. I had an issue in CI system and reinstall it. But I got a problem when the java already configured in database. My database is very important so I can remove schema. I chose CRM2007>Oracle>ABAP+JAVA>HA system>Central Instance in the sapinst.
CJS-30109 The Java load in database GOL/crmdb has already been configured. SOLUTION: Remove the schema and load it with a new load before you run this installation.
ThanksHello Ashutosh ,
Thanks for your reply.
We have gone followed the below sequence:
SCS Installation
Database Instance Installation using backup/restore method
CI installation. -> getting error, when we provide the Java Components DVD.
Best Regards,
Anuj -
Is it possible to connect the java with XL database
Hi friends,
Is it possible to connect the java with XL database.
if it is possible can u send the detail for that .
Thnax in Advance..............What the heck is a XL database?
-
No start instance Java (problem connection database DB2)
Hi, I have problem with start instance Java, problem connectio database.
S.O: Solaris
Database: DB2
show log db2:
ADM7519W DB2 could not allocate an agent. The SQLCODE is "-1225".
show log directory work:
com.sap.engine.frame.core.configuration.ConfigurationException: Error while connecting to DB.
at com.sap.engine.core.configuration.impl.persistence.rdbms.DBConnectionPool.createConnection(DBConnectionPool.java:365)
at com.sap.engine.core.configuration.impl.persistence.rdbms.DBConnectionPool.<init>(DBConnectionPool.java:130)
at com.sap.engine.core.configuration.impl.persistence.rdbms.PersistenceHandler.<init>(Persistence
Handler.java:38)
at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.<init>(ConfigurationCache.java:149)
at com.sap.engine.core.configuration.bootstrap.ConfigurationManagerBootstrapImpl.init(ConfigurationManagerBootstrapImpl.java:236)
at com.sap.engine.core.configuration.bootstrap.ConfigurationManagerBootstrapImpl.<init>(ConfigurationManagerBootstrapImpl.java:49)
at com.sap.engine.bootstrap.Synchronizer.<init>(Synchronizer.java:74)
at com.sap.engine.bootstrap.Bootstrap.initDatabaseConnection(Bootstrap.java:474)
at com.sap.engine.bootstrap.Bootstrap.<init>(Bootstrap.java:147)
at com.sap.engine.bootstrap.Bootstrap.main(Bootstrap.java:946)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:331)
at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:81)
Caused by: com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-10003, SQLSTATE=57011, SQLERRMC=null, DRIVER=3.59.81
[Bootstrap module]> Problem occurred while performing synchronization.
Help please.Hey Eli,
It looks like a memory issue. It would be good if you could provide more lines from db2diag.log file.
Please make sure that DB2 configuration complies with the default suggested. Below link would help you understand better.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.qb.server.doc/doc/t0008238.html
More over set the ulimit for virtual memory and maximum memory size to unlimited in order to maximize the use of your current physical memory, after that restart DB2.
Please let us know if issue gets resolved.
Cheers!!!
Vishi Rajvanshi -
Runtime paging with java for the database values.
I m preparing a project in which i cant try to page the data etracted from the database in runtime. Plz Help me for this problem.
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.DriverManager;
import java.util.List;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class AttachFormPagination extends Action
public AttachFormPagination()
public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception
try
int tot = 0;
String startIndex = request.getParameter("start");
String endIndex = request.getParameter("end");
System.out.println("---------start is>" + startIndex);
System.out.println("---------end is>" + endIndex);
int sIndex = Integer.valueOf(startIndex).intValue();
int eIndex = Integer.valueOf(endIndex).intValue();
Class.forName("org.gjt.mm.mysql.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/","id","pw");
Statement st = con.createStatement();
// this is for getting the total records
Statement st1 = con.createStatement();
ResultSet rs1 = st1.executeQuery("select * from tablename");
while(rs1.next())
tot++;
System.out.println("total value is" + tot);
String total = ""+tot;
String query = "select * from tablename limit " + sIndex + "," + eIndex;
System.out.println("---------query is>" + query);
ResultSet rs = st.executeQuery(query);
List cusList = new ArrayList();
AttachFormBean afb = null;
while(rs.next())
afb = new AttachFormBean();
afb.setName(rs.getString(1));
afb.setActivity(rs.getString(2));
afb.setProduct(rs.getString(3));
afb.setCompetitor(rs.getString(4));
afb.setEnvironment(rs.getString(5));
afb.setCreatedBy(rs.getString(6));
cusList.add(afb);
request.setAttribute("custlist",cusList);
request.setAttribute("startIndex",startIndex);
request.setAttribute("endIndex",endIndex);
request.setAttribute("total",total);
catch (Exception e)
System.out.println("Exception---------"+e);
return mapping.findForward("success");
}and
this code to be placed in ur page
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left">�</td>
<td nowrap align="right">
<a href="#" onclick="PagenationStart()">
<img src='images/start_off.gif' width='9' height='8' alt='Start' border='0' align='absmiddle' href="#" >�Start��</a>
<a href="#" onclick="PagenationPrevious()">
<img src='images/previous_off.gif' width='4' height='8' alt='Previous' border='0' align='absmiddle'>�Previous��</a>
<a href="#" onclick="PagenationNext()">
��Next�<img src='images/next_off.gif' width='4' height='8' alt='Next' border='0' align='absmiddle'></a>
<a href="#" onclick="PagenationEnd()">
��End�<img src='images/end_off.gif' width='9' height='8' alt='End' border='0' align='absmiddle'></a></td>
</tr>
</table>and put this in ur page inside script
function PagenationStart()
var a = 0;
var b = 4;
document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
document.ownerPage.submit();
function PagenationPrevious()
var a = eval('<c:out value="${requestScope.startIndex}"/>') - 4;
var b = 4;
document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
document.ownerPage.submit();
function PagenationNext()
var a = eval('<c:out value="${requestScope.startIndex}"/>')+4;
var b = 4;
document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
document.ownerPage.submit();
function PagenationEnd()
var a = eval('<c:out value="${requestScope.total}"/>')-4;
var b = eval('<c:out value="${requestScope.total}"/>');
document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
document.ownerPage.submit();
}
Maybe you are looking for
-
Does iWork for iOS allow me to open and edit documents created in the Microsoft Office suite?
Hi all, I have just purchased an iPad 2 32Gb. I want to be able to use it for work. I need to be able open and edit documents created in Microsoft Office. Primarily .doc and .docx files. Is this possible? or am I better with D2 or Documents to Go. Al
-
Error while opening the Incoming Payment Form
hi, When i open the incoming payment(Banking -> Incoming Payments -> Incoming Payment) in sap b1 07 i got a error message "linking primary sales account has not been completed" .how can i open it?
-
E-Mail in iOS 7.0.2 with massive problems sending big e-mails
Dear all, i have massive problems in sending e-mails with attachments using iOS 7.0.2 on an iPhone 5s using iCloud E-Mail services. If i try to send more than one photo done with the iPhone, it is just sending and sending, but after an endless time n
-
Btyahoo homepage not loading with Safari on iPad
Safari will not load my Bt Yahoo homepage, all other web page load ok.
-
Moving domain name from one plan to another
Hi guys, I am about to go live with my new partner site - hopefully today. However since there was no practical way to redo the free partner site - I decided I would just upgrade to a paid account. So my question is, as I will have to move my domain