Using jdbc StoredProcedure to return from a function an array of objects
I am trying to call a stored procedure(function) using jdbcTemplates with no inputs which returns a list of objects.
I previously used the same function returning a cursor and used the following example:
http://www.saarathi.com/wiki/Processing_JDBC_ResultSet_from_an_Oracle_stored_procedure_with_Spring#Calling_the_stored_procedure_and_function_from_Spring_JDBC_DAO
which worked fine.
I now want to return the same objects which relates to a table but in a list and have tried to follow the example in
http://forum.springframework.org/archive/index.php/t-10042.html
But have had no success and did not understand the example GetPersonProc.
I dont understand why it works for the cursor and not a list.
I would very much appreciate some help.
Hi
Can anybody help me with the code of how to return a resultset from a web service. i have put the resultset data's in an object array and tried to return it, but in the client side no data comes ,,, i mean it is printed as null.... and plz tell me where to specify the return type of a object in the wsdl file....
thanks..
Similar Messages
-
Exiting from SQLPLUS on failure returned from a function
I am working on Oracle 11g (R2). I want to call a function in package and if that function returns zero then I want to quit/exit from SQLPLUS prompt.
I will be calling that function of package from an .sql file.
How can i do this?
I can also call raise_application_error() from that function. Without using WHENEVER SQLERROR EXIT, is there any way of doing this?Thanks, but if i am calling that function from a .sql file, can i verify the return value and exit from sqlplus prompt.
-
Using JDBC Adapter posting data from Oracle database to Falt file????
Hi All,
By using JDBC adapter, for now I have to connect to Oracle Database and then get the employee information from the Employee Table and post it to the flat file, can you please help me out the complete procedure...
Thanks in advance
AndyHi Andy,
have a look at the help for configuring a JDBC Sender adapter: http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
It mentions all the settings you'll need to make e.g. the connection URL as posted above.
And it also lists how an XML file looks like that contains the query results according to the SQL Select statement in the adapter.
<resultset>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
</resultset>
So you have to create a datatype, message type and message interface to match this structure (of course you'll need to substitute column-name1 etc. with the column names in your select statement).
Now if you want to create a flat file from that, you have to create an XML representation of that flat file and use the content conversion in the receiver file adapter as defined here: http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Regards
Christine -
Using JDBC ? Style Parameters and Oracle Style :param on view objects
can i use :0 style on predicate side of a sql statement
example
===========================================================
select nvl(:0, null) from dual
===========================================================
After some test for me only work using ? style.
The ? style cause me problem on my already creaded master details view objects
Any help on this
Best RegardsFrank tnx for repply
My problems is , when i use parameters on functions like decode
===================================================
SELECT decode(:0,'VALOR1', 'VALOR1','SINVALOR') VALOR,
Dept.DEPTNO,
FROM DEPT Dept
and
SELECT decode(:0,'VALOR1', 'VALOR1','SINVALOR') VALOR,
Emp.EMPNO,
Emp.DEPTNO
FROM EMP Emp===================================================
on a view object that is detail view object (departments vo -> employees vo)
and have a view link EmpsByDeptViewLink
the parameter of my view link SQL dont work (in my case :1) <-param of SQL view link
In my vo :0 is my first parameter, :1 of my view link is my second parameter,
but when i access my EmpsByDept.do ADF page and set
ViewObject vo = getDeptView1();
vo.setWhereClause("DEPTNO = :0");
vo.setWhereClauseParam(0,"VALOR2");
vo.setWhereClauseParam(1,"10");
vo.executeQuery();
ViewObject vo1 = getEmpView1();
vo1.setWhereClause("EMPNO = :1");
vo1.setWhereClauseParam(0,"VALOR1");
vo1.executeQuery();its doesnot work.
I need to do some aditional steps to parameter of my view link SQL work?
Also i has uploaded a TestCase on http://www.geocities.com/mroseroc/ScottADFTest.zip
Errors from my Jdeveloper Debug level are:
=======================================================
SELECT * FROM (SELECT decode(:0,'VALOR1', 'VALOR1','SINVALOR') VALOR,
Emp.EMPNO,
Emp.ENAME,
Emp.JOB,
Emp.MGR,
Emp.HIREDATE,
Emp.SAL,
Emp.COMM,
Emp.DEPTNO
FROM EMP Emp) QRSLT WHERE (EMPNO = :1)
06/04/26 21:55:03 [915] Bind params for ViewObject: EmpView1
06/04/26 21:55:03 [916] Binding param 1: VALOR1
06/04/26 21:55:03 [917] ViewObject: EmpView1 close single-use prepared tatements
06/04/26 21:55:03 [918] QueryCollection.executeQuery failed...
06/04/26 21:55:03 [919] java.sql.SQLException: Missing parameter IN o OUT on index:: 2=======================================================
(EMPNO = :1) <- this value is never passed -
Bug: 1st Date value returned from CF function as an Array
I am encountering an annoying behavior in Flex. I call a CF function to return a query into an arraycollection - very basic. If the SELECT statement in the CF function includes any dates as returned values, the first date in the SELECT statement comes back into Flex as an array object that includes all of the fields in the query. The other dates are returned normally as Date data types.
This started happening a month or two ago, and I've reproduced it on several machines. Needless to say, it is causing numerous errors when my code excpects a Date and gets an Array.
Do you have any ideas of what might be causing this and what I can do about it?
Thanks!!I'm not sure where to post it, but here are some snippets:
in the cfc, I have a function as such:
<CFFUNCTION name="GetPersonLog" returntype="query">
<CFARGUMENT name="STUDENTID" type="numeric" required="Yes">
<CFQUERY name="qry" datasource="#connection_string#">
SELECT tblStudentLog.STUDENTLOGID, tblStudentLog.STUDENTID,
<!---GETDATE() AS TESTTHIS,--->
tblStudentLog.LOGDATE,
tblStudentLog.LASTUPDATED,
tblStudentLog.LOGENTRY
FROM tblStudentLog LEFT OUTER JOIN
tblStudentDiscipline ON tblStudentLog.StudentDisciplineID = tblStudentDiscipline.StudentDisciplineID
WHERE tblStudentLog.STUDENTID = <CFQUERYPARAM value = "#studentid#">
ORDER BY tblStudentLog.LOGDATE DESC
</CFQUERY>
<CFRETURN qry>
</CFFUNCTION>
You see I have a REMmed out line to get a test date. If I check the results in CF using cfdump, all dates come back as dates.
In flex, the handler for the call to this function is simple:
private function PersonLogHandler(event:ResultEvent):void{
personlog = event.result as ArrayCollection;
CursorManager.removeBusyCursor();}
If I stop the code here and evaluate the results in debug mode, I find that the LOGDATE result is an array of values, while the LASTUPDATED field is a date.
If I put back the GETDATE() AS TESTTHIS, statement in the cfc function, then the result includes LOGDATE as a date object, but now the TESTTHIS result is an array.
I have experienced this on 2 different machines, and it has brought my development to a standstill. I can't thin of what changed to start these problems, except that I am now using the FlashPlayer 10 (with debugger). This happens in Firefox and IE. I am using FlexBuilder 3 and Coldfusion 8. -
Dynamic return from a function based on an argument
I have a function that I am using to output a nested list of
child/parent relationships
the function works wonderfully except that i want to be able
to change the way the list is displayed depending on an argument
being passed
i want the list to be displayed twice on the same page, one
with output in a table, and one with output in a drop down box
i thought the easiest way would be to create an argument that
can be used in IF statements
look at my code below
quote:
<!--- establish default values --->
<cfparam name="output" default="">
<cfparam name="catNameOutput" default="">
<cfparam name="indent" default="">
<cffunction name="GenerateCategories" access="public"
returntype="string">
<!--- this holds the outermost parent value being passed
to the function --->
<cfargument name="GenCatParent" type="uuid"
required="yes" default=0 >
<!--- this holds the nested level we are on --->
<cfargument name="level" type="numeric" required="yes"
default=0 >
<!--- this holds the output_type we need for display
purposes --->
<cfargument name="output_type" type="numeric"
required="yes" default=0 >
<!--- grab the children of the received category --->
<cfquery name="rsCategoryChildren"
datasource="webdsn">
SELECT * FROM dbo.BlogCategories
WHERE catParent = '#GenCatParent#'
ORDER BY catName ASC
</cfquery>
<cfloop query="rsCategoryChildren">
<!--- keep track of the indentation needed depending on
which level we are at --->
<cfloop from="0" to="#arguments.level#" index="i">
<cfset indent = indent & " ">
</cfloop>
<!--- if the nest is being used in the dropdown on the
category manage page, we need to use option tags --->
<cfif arguments.output_type EQ 1>
<cfset catNameOutput = "<option value='" & catPK
& "'>" & indent & Trim(catName) &
"</option>">
</cfif>
<!--- if the nest is being used in the table on the
category manage page, we need to use table row tags --->
<cfif arguments.output_type EQ 2>
<cfset catNameOutput = "<tr>
<td>edit</td> <td>delete</td> <td>"
& indent & Trim(catName) & "</td>
</tr>">
</cfif>
<cfset output = output & catNameOutput>
<!--- reset the indentation --->
<cfset indent = "">
<!--- check for children of this child --->
<cfquery name="checkForKids" datasource="webdsn">
SELECT * FROM dbo.BlogCategories
WHERE catParent = '#rsCategoryChildren.catPK#'
ORDER BY catName ASC
</cfquery>
<!--- if there are any, call this function recursively
--->
<cfif checkForKids.recordcount GT 0>
<cfset GenerateCategories(genCatParent=catPK, level =
level +1, output_type = arguments.output_type)>
</cfif>
</cfloop>
<cfreturn output>
</cffunction>
<cfquery name="rsCategoryParents" datasource="webdsn">
SELECT * FROM dbo.BlogCategories
WHERE catParent IS NULL
ORDER BY catName ASC
</cfquery>
and here is how i am calling the function for each situation
(the table and the dropdown):
quote:
<table width="100%" class="managementtable">
<tr bgcolor="#F6F6F6">
<td> </td>
<td> </td>
<td>Category Name</td>
</tr>
<cfloop query="rsCategoryParents">
<cfoutput><tr> <td>edit</td>
<td>delete</td> <td>#Trim(catName)#</td>
</tr></cfoutput>
<cfset recursivecats =
GenerateCategories(genCatParent=catPK,level=0,output_type=2)>
<cfoutput>#recursivecats#</cfoutput>
</cfloop>
</table>
<!---------------------------------------------------------------------------->
<select name="select">
<option>None</option>
<cfoutput query="rsCategoryParents">
<option value="#catPK#">#Trim(catName)#</option>
<cfset recursivecats =
GenerateCategories(genCatParent=catPK,level=0,output_type=1)>
#recursivecats#
</cfoutput>
</select>
calling the function for the table and the dropdown on the
same page does not work
if the function is first called with the argument for table,
it tries to also output the table formatted code when the function
is called again (even if it is called again with the argument for
dropdown)
is there another way i can have the same function output two
different sets of data based on an argument? what am i doing wrong
thanks for your timesjlsam2,
Yeah, I think the main problem you had was a scoping one. For
the second function call, the output variable already contained all
of the output code from the first function call. In fact, I
wouldn't be surprised to find that the output string for the second
function call contained the output of the first plus the output of
the second, and that it didn't render correctly on screen. A
View Source would have determined that.
Anyhow, I suggest that you VAR your output variable as
cf_dev2 suggests, and delete the three CFParam lines at the top.
Further, your recursive call would therefore need to return it's
result to the output variable, thus completing the recursive loop.
See below:
<!--- this holds the output_type we need for display
purposes --->
<cfargument name="output_type" type="numeric"
required="yes" default=0 >
<CFSet Var Output = "">
<CFSet Var catNameOutput = "">
<CFSet Var indent= RepeatString(" ",
Arguments.Level)>
<!--- grab the children of the received category --->
<cfquery name="rsCategoryChildren" datasource="webdsn">
SELECT * FROM dbo.BlogCategories
and
<!--- if there are any, call this function recursively
--->
<cfif checkForKids.recordcount GT 0>
<cfset
Output = Output & GenerateCategories(genCatParent=catPK,
level = level +1, output_type = arguments.output_type)>
</cfif>
</cfloop>
This is what I suggest with your code. HTH :)
Swift -
How to compare a boolean value returned from a function in a sql query
Hi all
i have a function which return boolean true or false.
mean while i am writing a sql query which should check this function and will return a result set only when it is true. how will i use a function which returns boolean in a sql query..
thanks in advance'
HariI don't think this is possible - i'm not sure. Can you post your function script? The reason why am i asking this is --
satyaki>set serveroutput on
satyaki>
satyaki>
satyaki>
satyaki>create or replace function test_satf(emno in number)
2 return boolean
3 is
4 v_cnt number(5);
5 v_flg boolean;
6 begin
7 select count(*)
8 into v_cnt
9 from emp
10 where empno = emno;
11
12 if v_cnt = 1 then
13 v_flg := TRUE;
14 else
15 v_flg := FALSE;
16 end if;
17
18 return v_flg;
19 exception
20 when others then
21 v_flg := FALSE;
22 return v_flg;
23 end;
24 /
Function created.
satyaki>
satyaki>
satyaki>
satyaki>
satyaki>
satyaki>desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
satyaki>
satyaki>
satyaki>
satyaki>select count(*) from emp;
COUNT(*)
14
satyaki>
satyaki>select empno,test_satf(empno)
2 from emp;
select empno,test_satf(empno)
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
satyaki>select to_char(test_satf(empno))
2 from emp;
select to_char(test_satf(empno))
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
satyaki>
satyaki>create or replace function test_satf(emno in number)
2 return varchar2
3 is
4 v_cnt number(5);
5 v_flg varchar2(10);
6 begin
7 select count(*)
8 into v_cnt
9 from emp
10 where empno = emno;
11
12 if v_cnt = 1 then
13 v_flg := 'TRUE';
14 else
15 v_flg := 'FALSE';
16 end if;
17
18 return v_flg;
19 exception
20 when others then
21 v_flg := 'FALSE';
22 return v_flg;
23 end;
24 /
Function created.
satyaki>
satyaki>
satyaki>select test_satf(empno)
2 from emp;
TEST_SATF(EMPNO)
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TEST_SATF(EMPNO)
TRUE
TRUE
TRUE
14 rows selected.Or, may be i'm missing something.
Regards.
Satyaki De. -
How to collect returns from recursive function calls without a global var?
Usually global variables shouldnt be used, I was told. Ok. But:
How can I avoid using a global var when recursively using a function, when the function returns an object and when I want to have the collection of all these objects as the result?
For example, I think of determine the users of a group including group nesting. I would write a function that adds the direct group members to a collection as a global var and call itself recusively if a member is another group. This recursively called function
would do as well: Update the global var and if needed call itself.
I'm afraid this is no good programming style. What algorithm would be better, prettier? Please dont focus on the example, it is a more general question of how to do.
Thanks
WalterI rarely needed to create/use recursive functions. Here's one example I did:
function New-SBSeed {
<#
.Synopsis
Function to create files for disk performance testing. Files will have random numbers as content.
File name will have 'Seed' prefix and .txt extension.
.Description
Function will start with the smallest seed file of 10KB, and end with the Seed file specified in the -SeedSize parameter.
Function will create seed files in order of magnitude starting with 10KB and ending with 'SeedSize'.
Files will be created in the current folder.
.Parameter SeedSize
Size of the largest seed file generated. Accepted values are:
10KB
100KB
1MB
10MB
100MB
1GB
10GB
100GB
1TB
.Example
New-SBSeed -SeedSize 10MB -Verbose
This example creates seed files starting from the smallest seed 10KB to the seed size specified in the -SeedSize parameter 10MB.
To see the output you can type in:
Get-ChildItem -Path .\ -Filter *Seed*
Sample output:
Mode LastWriteTime Length Name
-a--- 8/6/2014 8:26 AM 102544 Seed100KB.txt
-a--- 8/6/2014 8:26 AM 10254 Seed10KB.txt
-a--- 8/6/2014 8:39 AM 10254444 Seed10MB.txt
-a--- 8/6/2014 8:26 AM 1025444 Seed1MB.txt
.Link
https://superwidgets.wordpress.com/category/powershell/
.Notes
Function by Sam Boutros
v1.0 - 08/01/2014
#>
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Low')]
Param(
[Parameter(Mandatory=$true,
ValueFromPipeLine=$true,
ValueFromPipeLineByPropertyName=$true,
Position=0)]
[Alias('Seed')]
[ValidateSet(10KB,100KB,1MB,10MB,100MB,1GB,10GB,100GB,1TB)]
[Int64]$SeedSize
$Acceptable = @(10KB,100KB,1MB,10MB,100MB,1GB,10GB,100GB,1TB)
$Strings = @("10KB","100KB","1MB","10MB","100MB","1GB","10GB","100GB","1TB")
for ($i=0; $i -lt $Acceptable.Count; $i++) {
if ($SeedSize -eq $Acceptable[$i]) { $Seed = $i }
$SeedName = "Seed" + $Strings[$Seed] + ".txt"
if ($Acceptable[$Seed] -eq 10KB) { # Smallest seed starts from scratch
$Duration = Measure-Command {
do {Get-Random -Minimum 100000000 -Maximum 999999999 |
out-file -Filepath $SeedName -append} while ((Get-Item $SeedName).length -lt $Acceptable[$Seed])
} else { # Each subsequent seed depends on the prior one
$PriorSeed = "Seed" + $Strings[$Seed-1] + ".txt"
if ( -not (Test-Path $PriorSeed)) { New-SBSeed $Acceptable[$Seed-1] } # Recursive function :)
$Duration = Measure-Command {
$command = @'
cmd.exe /C copy $PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed $SeedName /y
Invoke-Expression -Command:$command
Get-Random -Minimum 100000000 -Maximum 999999999 | out-file -Filepath $SeedName -append
Write-Verbose ("Created " + $Strings[$Seed] + " seed $SeedName file in " + $Duration.TotalSeconds + " seconds")
This is part of the SBTools module and is used by the
Test-SBDisk function.
Example use:
New-SBSeed 10GB -Verbose
Test-SBDisk is a multi-threaded function that puts IO load on target disk subsystem and can be used to simulate workloads from multiple machines hitting the same SAN at the same time, and measure disk IO and performance.
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx -
How to use JDBC to access "returning " clause
I think it is important to note here that you DO NOT have to use SQLJ for this. You can achieve the same result in plain JDBC. You must put the PL/SQL block in a CallableStatement object.
e.g.
CallableStatement cs = conn.prepareCall("declare myReturnValue table_name.field_name%type; begin insert into table_name (field1, field2, ... fieldn) values (?, ?, ... ?) returning fieldx into ?; end;");
To get hold of the "returning" parameter, register it as an OUT parameter (method 'registerOutParameter').
That should do it!! Email me if you need further explanation,
regards,
AlexI think it is important to note here that you DO NOT have to use SQLJ for this. You can achieve the same result in plain JDBC. You must put the PL/SQL block in a CallableStatement object.
e.g.
CallableStatement cs = conn.prepareCall("declare myReturnValue table_name.field_name%type; begin insert into table_name (field1, field2, ... fieldn) values (?, ?, ... ?) returning fieldx into ?; end;");
To get hold of the "returning" parameter, register it as an OUT parameter (method 'registerOutParameter').
That should do it!! Email me if you need further explanation,
regards,
Alex
null -
Selecting from a function that returns a sys refcursor or an alternative
I have a query that returns a resultset of three columns, namely SSN,PAID_YEAR and PAID_TOTAL. From this query I can:
Create a view and then query it.
Create a function and return resultset
If I go the first way a simple query like the following takes more than 20 seconds:
SELECT PAID_YEAR,PAID_TOTAL FROM VIEW_1 WHERE SSN=12345678912882;
I know that is because when I query a view the engine first brings all the rows of the view and then it filters the rows for the criteria supplied.
If I go the second way I can send a parameter and make the engine look only for those rows that match the condition and return the recordset. But I do not know how to then SELECT from that returned resultset. I took a look at pipelined tables but didn't quite get how to benefit them. So my ultimate question is if it's somehow possible to select from the resultset that is returned from a function like this:
SELECT * FROM FUNCTION_1(12132323232).
If yes, then how, if no, what would be an alternative way?I know that is because when I query a view the engine first brings all the rows of the view and then it filters the rows for the criteria supplied.
No - you don't 'know that' because it isn't true. Just check the explain plan for yourself. Oracle can still use any appropriate indexes so that only the rows needed are returned.
So my ultimate question is if it's somehow possible to select from the resultset that is returned from a function like this:
SELECT * FROM FUNCTION_1(12132323232).
No - you can't do it like that. You have to use the TABLE function to treat the function result set as a table:
'SELECT * FROM TABLE(FUNCTION_1(12132323232)).
-- type to match emp record
create or replace type emp_scalar_type as object
(EMPNO NUMBER(4) ,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7, 2),
COMM NUMBER(7, 2),
DEPTNO NUMBER(2)
-- table of emp records
create or replace type emp_table_type as table of emp_scalar_type
-- pipelined function
create or replace function get_emp( p_deptno in number )
return emp_table_type
PIPELINED
as
TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
emp_cv EmpCurTyp;
l_rec emp%rowtype;
begin
open emp_cv for select * from emp where deptno = p_deptno;
loop
fetch emp_cv into l_rec;
exit when (emp_cv%notfound);
pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
end loop;
return;
end;
select * from table(get_emp(20)) -
Building the varchar string to return from a pl sql function
i'm new with pl/sql and i'm having trouble trying to build the string that i want to return from a function that is inside a package. it seems my problem stems from the fact that i'm trying to incorporate a variable (varchar2) into the string to be returned. below are two attempts that i've made which do not work:
function test_policy (p_schema_name IN varchar2, p_object_name IN varchar2) return varchar2 as
predicate_value varchar2(2000);
user_name varchar2(100);
begin
select first_name
into user_name
from employees
where first_name = SYS_CONTEXT('hr_app_context', 'username');
predicate_value := 'first_name = ' || user_name;
predicate_value := 'first_name = ' || '' || user_name || '';
return predicate_value;
end test_policy;
Can someone help me with the proper syntax to build my string for the return value? Thanks.this function implements the code for a policy i've created. basically, the policy says that when i do a select on the employees table, i should only see a record whose first_name = sys_context('hr_app_context', 'username'). so, when i perform a simple select * from employees, i get an error which says policy predicate has error. i'm pretty sure the error is caused by how i'm building the return value for that function. if i hard code some return value like:
predicate_value := 'first_name = ''HR''' ;
the select statement above works fine, and i only see the record from employees where first_name = 'HR' -
Hi guys,
I am working on an AIR Application that Uses Flex and AMFPHP remoting, The returned data type is an array of objects containing a sting an a url to an image on the server, How do bind this to a tilelist so i have a list with images representing the icons and the string representing labels of the Tilelist?We assume that the object have these two fields:
- label
- image
so you may first pass the Array to the dataProvider of the TileList and make an ItemRenderer (with a label and a image). Then in the ItemRenderer, access to the objects fields with data:
ItemRenderer.mxml
<mx:VBox>
<mx:Label text="{data.label}"/>
<mx:Image source="{data.image}"/>
</mx:VBox> -
Executing Select query using JDBC Receiver Adapter
I created couple types in Oracle and also new function instead of procedure
Can I execute the above query using JDBC Receiver Adapter.
select *
from the ( select cast( apr.get_distribut('', '', '', 'hdfcgd', 'CAN') as dsrTable )
from dual );
If possible how my message structure should look like...Hi vikram,
If you use JDBC as Receiver Adapter you can only post the data to the data base I do no think so we can select the records from the data base.
If you use JDBC as Sender hope,we can the select query in the sender communication channel.
Hope I am clear.
Thanks and Regardds,
Chandu. -
How to Connect Microsoft SQL 2000 database using JDBC
Hi all..
I want to connect Microsoft SQL 2000 database using JDBC. I want from initial steps also. (about JDBC driver & its installation)
ThankzJust checkout the SQL Server JDBC Driver Documentation at the manfacturer's site: http://msdn2.microsoft.com/en-us/data/aa937724.aspx
-
Inserting Multiple Images into oracle database using JDBC
I wanted to insert multiple images into database using JDBC by reading it from the file... and i am passing photos.txt(my text file) as an input parameter... I have inserted all the values into the database except for the image part... this is my content of photos.txt file and i have copied all the images into the folder
*" C:\\photos "*
*1,in1.jpg,108,19,in-n-out*
*2,in2.jpg,187,21,in-n-out*
*3,in3.jpg,308,41,in-n-out*
*4,in4.jpg,477,52,in-n-out*
*5,in5.jpg,530,50,in-n-out*
and i want to store in1.jpg,in2.jpg,in3.jpg,in4.jpg,in5.jpg into the oracle databse using JDBC.... i have tried a lot using BLOB column.... and i have created my table as
CREATE TABLE PHOTO(
ID NUMBER NOT NULL PRIMARY KEY ,
Name BLOB,
X DOUBLE PRECISION,
Y DOUBLE PRECISION,
Tags VARCHAR2(40)
try { // for restaurant System.out.println();System.out.println();System.out.println(); System.out.print(" Creating Statement for Photo...\n"); stmt2 = con.createStatement (); stmt2.executeUpdate("delete from PHOTO"); stmt2.executeUpdate("commit"); PreparedStatement stmt3 = con.prepareStatement ("INSERT INTO PHOTO VALUES (?, ?, ?, ?, ?)"); System.out.print(" Create FileReader Object for file: " + inputFileName1 + "...\n"); FileReader inputFileReader2 = new FileReader(inputFileName1); System.out.print(" Create BufferedReader Object for FileReader Object...\n"); BufferedReader inputStream2 = new BufferedReader(inputFileReader2); String inLine2 = null; String[] tokens; // String[] imageFilenames = {"c:\\photos\\in1.jpg","c:\\photos\\in2.jpg","c:\\photos\\in3.jpg","c:\\photos\\in4.jpg","c:\\photos\\in5.jpg", // "c:\\photos\\in6.jpg","c:\\photos\\in7.jpg","c:\\photos\\in8.jpg","c:\\photos\\in9.jpg","c:\\photos\\in10.jpg","c:\\photos\\arb1.jpg","c:\\photos\\arb2.jpg", // "c:\\photos\\arb3.jpg","c:\\photos\\arb4.jpg","c:\\photos\\arb5.jpg","c:\\photos\\den1.jpg","c:\\photos\\den2.jpg","c:\\photos\\den3.jpg", // "c:\\photos\\den4.jpg","c:\\photos\\den5.jpg","c:\\photos\\hop1.jpg","c:\\photos\\hop2.jpg","c:\\photos\\hop3.jpg","c:\\photos\\hop4.jpg","c:\\photos\\hop5.jpg"}; File file = new File("C:\\photos\\in1.jpg"); \\ ( Just for example ) FileInputStream fs = new FileInputStream(file); while ((inLine2 = inputStream2.readLine()) != null) { tokens= inLine2.split(","); st2 = new StringTokenizer(inLine2, DELIM); stmt3.setString(1, tokens[0]); stmt3.setBinaryStream(2, fs, (int)(file.length())); stmt3.setString(3, tokens[2]); stmt3.setString(4, tokens[3]); stmt3.setString(5, tokens[4]); stmt3.execute(); //execute the prepared statement stmt3.clearParameters();
As i am able to enter one image file by above code in1.jpg in to the oracle database.... but i am not able to insert all the image file in to the database.....do tell me what should i do.... and can you give me the example on the basis of the above code of mine...
do reply as soon as possible..jwenting wrote:
that depends. Putting the images in BLOBs prevents the file locations stored in the database from getting out of synch with the filesystem when sysadmins decide to reorganise directory structures or "archive" "old" files that noone uses anyway.True, but it really comes down to a business decision (cost-benefit analysis). If you have the bucks, the expertise, and the time, go with the Blobs, otherwise go with the flat files.
Maybe you are looking for
-
About 2 weeks ago I plugged my wife's iphone 4S to our pc to update it to IOS 7and backup her iphone info to icloud. When I was done my wife's iphone had my daughter's ipod info on it and I can't find my wife's info on icloud anywhere. My wife has a
-
Hi I have one Zreport which gives the result in ALV form. After getting the result(1 row with 33 columns) when I tried to export the ALV results to spread sheet using the option : List-> Export-> Spread Sheet OR by click on Excel icon in the display
-
hallow i have two tables that i wont to move the data(price) from first table INTAB_A132 to table zempkostlprice_rec. in table zempkostlprice_rec i have 2 colman one is date and resrc and i wont to add from table INTAB_A132 the price to zempkostlpric
-
I think this service may be the solution to my needs....if it works the way I'm understanding it. Let me know if there is something else offered. Here is my scenario: I have a chain of command with 4 people. Person number 1, needs to meet with a c
-
Hi. I am having a bit of a problem. I have an iBook G4, but I've always had a PC so I am still learning about Macs. At school, I am able to connect to the internet either with the use of an ethernet cable or with wireless. However, at home, I have di