Flex database/query return
Hi all,
I'm hoping someone can help me out with a rather strange
issue. I have been coding dashboards in Flex Builder 2 and ,until
recently, serving them out with Coldfusion 7.0.2. Everything was
working fine until I upgraded to ColdFusion 8. I started getting
some bizzare totals in some of my chart headings.
I traced the problem and it looks like when I receive numeric
data as a return value from a query through a CFC/Remote Object,
they are being converted to strings. So, code that I had previously
used to add these (formerly) numeric values were now concatenating
them. I'm at a loss as to what I should do, as I've tried
explicitly casting them as Numbers on return. has anyone else
noticed a similar issue, or know of a change in result handling
from 7.0.2 to 8?
Thanks,
Jeff
I am having what may be a related problem, but I'm not really
sure. I am working with CF 7 and SQL Server 2005. When I return a
varchar from a stored procedure, it is always truncated to a
one-character string in CF, regardless of its length in the
database. I have verified that the problems lies somewhere between
SQL Server and ColdFusion rather than between ColdFusion and Flex.
Interestingly, when I emulate the behavior of the stored
procedure by using a <cfquery> tag and submitting the SQL
statement to the DBMS, the varchar comes back as expected, at its
full length. So the problem seems to have something to do with the
stored procedure mechanism, but I am unable to determine if it is a
problem in CF, in SQL Server, or elsewhere, perhaps in the ODBC
driver.
I posted this issue to this forum 3 weeks ago, but no one has
responded, and I am still trying to diagnose the problem. Perhaps
this issue is related to the one you are wrestling with, perhaps
not. I wish I could be oof more help. Sorry, that's the best I can
do.
Similar Messages
-
HELP! executing "use database" query returns exception!
I have several databases running on my PC through port 1319 (MSSQL port) and I need to determinate which concrete I should use.
when I put:
SQLStatement.executeQuery("use ester");
he returns to me:
Error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]No ResultSet set was produced.
so how to determinate it?hi Kirillica
SQLStatement.executeQuery("use ester");
return only resultset
u have to do something like
Resultset rs = SQLStatement.executeQuery("use ester");
then find info from rs
hope this help
Regards
Satinderjit -
I'm writing a Java program that needs to query a Microsoft Access database. I'm not sure how to do this. Someone said to use ODBC drivers but I don't know what these are. Any clarification/ideas would be appreciated.
There are a few easy step to set up a connection to your database in your java program.
1. establish an odbc data source in windows control panel (may be under Administrative tools).
2. you need to import the java.sql package.
3. you need a connection, so type the following into your database class:
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:/*your data source name goes here*/");
catch (ClassNotFoundException exception)
System.err.println("Failed to load JDBC/ODBC driver");
exception.printStackTrace();
System.exit(1);
catch (SQLException exception)
System.err.println("Unable to connect");
exception.printStackTrace();
System.exit(1);
}4. Find an SQL tutorial on the web.
5. For each query/update etc create a Statement object using the following code:
try
Statement statement = connection.createStatement();
/* now use the remainder of this try block to execute your query. Each database query returns a ResultSet object */
ResultSet resultSet = statement.executeQuery("/*your query string goes here*/");
/* the next() method in ResultSet returns true if there are any more records, like an iterator. Therefore, you know if there are any results or not*/
if (resultSet.next())
/* If your query was a 'SELECT * FROM ...etc' then you will get a whole row from the table(s) within the database. if you need to extract a number from that record and you know the column number, then use the following */
int id = resultSet.getInt(1);
/* where 1 corresponds to the first column in the table, and so on. Ifyou want to extract a String, the use the getString() method*/
catch (SQLException exception)
}That's basically the easiest way to go about it (I think). Best to consult a book for a more in-depth look. Try Java - How to Program, by Deitel and Deitel (available at www.deitel.com). I found this very useful. -
CONNECT BY QUERY returns different count of rown in 10g resp. 11g databases
Folks,
I just spot a bellow issue in our databases.
1.) 10g database:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from global_name;
SQL> SELECT ROWNUM
2 FROM dual
3 CONNECT BY ROWNUM <= 2;
ROWNUM
1
2
3
SQL> 2. 11g database
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from global_name;
SQL> SELECT ROWNUM
2 FROM dual
3 CONNECT BY ROWNUM <= 2;
ROWNUM
1
2
SQL> As you can see in 10g above query returns 3 records, in 11g only 2.
Why it's like that? Can it be somehow set, to produce the same output?
Many thanks,
TomasI get correct rows on both database version !
Oracle Versions
10g 10.2.0.1.0
11g 11.1.0.6.0
SQL> select rownum from dual connect by rownum <= 2;
ROWNUM
1
2
SQL> select * from v$version ;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> select rownum from dual connect by rownum <= 2;
ROWNUM
1
2
SQL> select * from v$version ;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production -
Returning database query results under Apache Axis
I'm trying to write a web service that will return the results of a standard database query. Does anyone have any pointers on what sort of data structure I should convert my ResultSet to that would be best suited to run under Apache Axis? Currently I am trying to use a String[][][], which Axis can serialize and encode fine, but seems to have problems decoding. If someone has some client-side source that is able to receive a String[][][], please post it, as I would rather not have to change the web services around if at all possible.
According to IBM, the best way to do this is by returning an array of a complex type. Using this idea, I changed my services to return an array of DBRow objects, which I wrote for this purpose. DBRow is a simple class that contains a single private String[] with get and set accessors, in accordance with the JavaBeans standard. If you need more details, just respond to this topic.
-
Using orcl:query-database to return a number of Columns
I have a BPEL process that is pulling data from some Database tables everything is working fine.
I now need to perform a lookup on the database to pull in some additional information (3 additional attributes) within the stylesheet, where each attribute comes from a separate table.
i.e.
select a.col1, b.col1, c.col1
from tab1 a
,tab2 b
, tab3 c
where a.col2 = b.col2
and .......blah blah blah....
I have used the orcl:database-query successfully to retrieve a single column and a single row and it works great.
However i'd like to run the above query as one statement, rather than 3 separate queries.
I've googled the fucntion for examples where it returns a nodelist or XML snippet, but to no avail.
I've tried it before and couldn't get it to work.
Does anyone have any examples.
Thanks in advance.
StuartI have a BPEL process that is pulling data from some Database tables everything is working fine.
I now need to perform a lookup on the database to pull in some additional information (3 additional attributes) within the stylesheet, where each attribute comes from a separate table.
i.e.
select a.col1, b.col1, c.col1
from tab1 a
,tab2 b
, tab3 c
where a.col2 = b.col2
and .......blah blah blah....
I have used the orcl:database-query successfully to retrieve a single column and a single row and it works great.
However i'd like to run the above query as one statement, rather than 3 separate queries.
I've googled the fucntion for examples where it returns a nodelist or XML snippet, but to no avail.
I've tried it before and couldn't get it to work.
Does anyone have any examples.
Thanks in advance.
Stuart -
Returning the result of a database query to a client
glassfish
JAX-WS 2.0
NetBeans 5.5
Is it possible to send a CachedRowSet object to a client?
I get an error when i try to do so. (I can't deploy the web service method that returns the CachedRowSet)
Is there a better way to return the result of database query to a client?
I'd appreciate any suggestions or sample code.Hi!
The result of this query will be the max ID of users' IDs.
Let say we have:
String sql="select max(users.id) from users";
Statement st = ctx.conn.createStatement();
ResultSet rs = st.executeQuery(sql);
rs.next();
So you can get the max Id in the following way:
int maxId=rs.getInt("id");
Regards,
Rossi -
Hi all,
how to find physical query from report here m checking like Administrator->manage session--> report-->view log
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- SQL Request:
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- General Query Info:
Repository: Star, Subject Area: AAA, Presentation: AAA
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Cache Hit on query:
Matching Query: Created by: Administrator
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Query Status: Successful Completion
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 0, DB-connect time 0 (seconds)
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Rows returned to Client 6
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Logical Query Summary Stats: Elapsed time 0, Response time 0, Compilation time 0 (seconds)
but here m not able to find database query..how to find that query plz help
Edited by: Sonal on Jan 3, 2011 5:29 AM
Edited by: Sonal on Jan 3, 2011 5:30 AM
Edited by: Sonal on Jan 3, 2011 5:30 AMHi,
as Daan said, set the variable in Advanced tab but not on loglevel..
because, our problem is to bypass the bi-server cache.
Do this:
1. Go to Advanced tab.
2. In Prefix field(scroll down to see this field) , enter this:
SET DISABLE_CACHE_HIT = 1;
Note: Make sure that you're ended up above statement with semicolon and do not click on Set SQL option...
3. Save report, then run it..
4. After you see the query, i recommend you to take take out that prefix tag then save it again.. -
Generate an xml file from Database query results
Hi, can anyone help me out with this problem I'm having. What are the steps in creating an xml file directly from the results of a database query. I currently have a very simply process that queries a database via a partner link. The query returns the data but it's from this point that I am stuck. I need to create an xml file with the data along with the xml tags. I've looked at dozens of tutorials with no luck.
I would greatly appreciate help with this.
bpel rookieShould be quite simple.
Create another partnerlink, configure it to use the file adapter, and write to an XML file. In this case you need to create an XML Schema (.xsd) of the file you want to create.
Before you write to the file, either add assign steps to copy individual attributes or use a transform activity to convert from the database format to the file (xml) format. -
Mysql query returns different number of records from coldfusion and navicat
Hi
I'm hoping that someone can suggest a basic strategy to debug this.
I have a fairly large and complicated query that is executed by a function in a cfc.
It returns (for example) 100 rows.
If I use cfdump and then copy and paste the SQL of the query (with the variables, of course) into Navicat and execute exactly the same query on the same mySQL database, it returns 130 rows.
Same SQL string, same database, same data - the only difference is that in one instance Navicat submits the query and in the other, Coldfusion does.
Has anyone ever had anything like this happen before?Ok I found my own bug. Of *course* the sql queries were not identical.. they could not possibly have been. My mistake was thinking that they were.
The problem was part of the WHERE clause:
AND orderid in (500,503,505)
In the coldfusion code this was
AND orderid in (<cfqueryparam cfsqltype="cf_sql_varchar" value="#lstOrderID#">)
which of course rendered in mySQL as AND orderid in ('500,503,505')
This was not immediately apparent as the cfdump returns this as AND orderid in (?) with the variable in the array below. -
XPATH Database Query Syntax in an Assign
Trying to get an XPATH Database query to work by assigning the Input variable value in a simple BPEL Process to my query condition. I keep getting invalid XPATH errors. I cannot seem to figure out how get write it out.
Here is what I have:
<from expression="orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')"/>
Here is my error:
Error(30): [Error ORABPEL-10039]: invalid xpath expression [Description]: in line 30 of "C:\OraBPELPM_1\integration\jdev\jdev\mywork\BPELws\ReadDB\ReadDB.bpel", xpath expression "orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')" specified in <from> is not valid, because XPath query syntax error. Syntax error while parsing xpath expression "orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')", at position "80" the exception is Expected: ). Please verify the xpath query "orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')" which is defined in BPEL process. . [Potential fix]: Please make sure the expression is valid.
Any help?
Thanks!!!Ok. I have figured out how to place the condition (variable value) inside a concatentated string. So my final result is the actual XPATH Query-Database statement. But the problem is it is being returned as a String. How can I turn that final string into the XPATH expression I need? I suspect another <COPY> block could pull this off but I am not sure how to do it.
Here is my code:
<process name="QueryBuild" targetNamespace="http://xmlns.oracle.com/QueryBuild" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:client="http://xmlns.oracle.com/QueryBuild" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
<partnerLinks>
<partnerLink name="client" partnerLinkType="client:QueryBuild" myRole="QueryBuildProvider"/>
</partnerLinks>
<variables>
<variable name="inputVariable" messageType="client:QueryBuildRequestMessage"/>
<variable name="outputVariable" messageType="client:QueryBuildResponseMessage"/>
<variable name="QueryText" type="ns1:string"/>
</variables>
<sequence name="main">
<receive name="receiveInput" partnerLink="client" portType="client:QueryBuild" operation="process" variable="inputVariable" createInstance="yes"/><!-- Generate reply to synchronous request -->
<assign name="Assign_1">
<copy>
<from expression="concat("orcl:query-database('select ename from emp where empno = ", bpws:getVariableData('inputVariable','payload','/client:QueryBuildProcessRequest/client:input'), ",false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL)'")"/>
<to variable="QueryText"/>
</copy>
<copy>
<from variable="QueryText"/>
<to variable="outputVariable" part="payload" query="/client:QueryBuildProcessResponse/client:result"/>
</copy>
</assign>
<reply name="replyOutput" partnerLink="client" portType="client:QueryBuild" operation="process" variable="outputVariable"/>
</sequence>
</process> -
Same Query returning different result (Different execution plan)
Hi all,
To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
The query :
SELECT *
FROM schema.table@database a
WHERE column1 IN ('3')
AND column2 = '101'
AND EXISTS
(SELECT null
FROM schema.table2 c
WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
Rows Row Source Operation
0 NESTED LOOPS (cr=31 r=0 w=0 time=4894659 us)
4323 SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
4336 TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
0 REMOTE (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
Rows Row Source Operation
3702 HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
22556 REMOTE (cr=0 r=0 w=0 time=401176 us)
4336 TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
It'is a bug or i have missed somthing ?
PS: The two table are no subject to insert or update statement.
Oracle version : 9.2.0.2.0
System version : HP-UX v1
Thanks.H.Mahmoud wrote:
Oracle version : 9.2.0.2.0
System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version) -
Hi Experts,
An out of box Question, but i expect that someone might have faced this problem and has been successful in searching the way out of it.
Am getting a message on running the following symmetric command to take archive log backup.
symioctl archive log
On issuing the above command , it returns me this message :
"Database query support is not installed"
Can anyone help me? How can i install database query support ?
Thanks in advance,,,,
MBThis is the technique that I use to count rows:
Quick trick that I use is
1. make sure that your Statement is type_scroll_insensitive:
connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);2. move your cursor to the last row(after executing your query)
resultset.last();3. get the row number:
int numberOfRows = resultset.getRow(); /*returns the number of rows*/4. set the cursor back to the beginning:
resultset.beforeFirst();5. ready to process the rows as usual.
This technique has a drawback though:
a scrollable resultset has less performance than non-scrollable
hope this might help,
Jamie -
I have made a database query:
try{
java.lang.Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:abc@abc","login","pwd");
HashMap params=new HashMap();
q=new Query("CORE_SYSTEM/TRN_SHORD_DESC",true);
dbr=q.executeQuery(params,con);
taQueryOut.setText(""+q);
taQueryOut.append(""+dbr);
}catch(Exception e){
e.printStackTrace();
} // end try-catch
The code is not important, it works.
What methods are there for me to use for printing out the number of results returned etc. A link to a reference material would be handy too. Note that the database used is Oracle, so if there are any ora-specific functions available, good.This is the technique that I use to count rows:
Quick trick that I use is
1. make sure that your Statement is type_scroll_insensitive:
connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);2. move your cursor to the last row(after executing your query)
resultset.last();3. get the row number:
int numberOfRows = resultset.getRow(); /*returns the number of rows*/4. set the cursor back to the beginning:
resultset.beforeFirst();5. ready to process the rows as usual.
This technique has a drawback though:
a scrollable resultset has less performance than non-scrollable
hope this might help,
Jamie -
Thread monitoring for database query
Hi,
I need to be able to store a database query in a thread. This means that the entire query from executing to return should take place in this thread (as well as connection etc). I would then like to know when it have finished its work so i can carry on some more porcessing.
I tried doing this with two threads, one to do the work and the other to 'watch' and then tell me when is is done. However, i errors 'every now and again' to which i can attribute to my thread structure not working properly. I am using a synchronised class and code post the code if anyone wishes to see it, however, i would appreciate it if someone could give me a basic structure to how i can go about this so that i do not get these 'random' errors.
Thanks RudyOkay -
I have an idea. Withut fully implementing your code, mind you.
If looks like you're having problems with concurrent access to your Vector.
A Vector is, of course, a Collection and a List (interfaces) - these are not thread safe. To make them thread safe, you need to "wrap" them.
<lifted from JavaDocs>
public static Collection synchronizedCollection(Collection c)
Returns a synchronized (thread-safe) collection backed by the specified collection. In order to guarantee
serial access, it is critical that all access to the backing collection is accomplished through the returned
collection.
It is imperative that the user manually synchronize on the returned collection when iterating over it:
Collection c = Collections.synchronizedCollection(myCollection);
synchronized(c) {
Iterator i = c.iterator(); // Must be in the synchronized block
while (i.hasNext())
foo(i.next());
Failure to follow this advice may result in non-deterministic behavior.
The returned collection does not pass the hashCode and equals operations through to the backing
collection, but relies on Object's equals and hashCode methods. This is necessary to preserve the
contracts of these operations in the case that the backing collection is a set or a list.
The returned collection will be serializable if the specified collection is serializable.
Parameters:
c - the collection to be "wrapped" in a synchronized collection.
Returns:
a synchronized view of the specified collection.</lifted from JavaDocs>
Give your Vector a wrapper and see if that solves your problem.
+M
Maybe you are looking for
-
Why does my website only not work in Google Chrome?
I've made a pretty simple webpage just to test out the drag and drop function. This website works completely when I open it in Firefox, Internet Explorer, using an iPad and another tablet. However when I open it in chrome, it only displays the preloa
-
Any body encountered a problem with the Nokia N8 speed Dial? when I keep pressing a number assigned to a contact, the phone freezes and reboots... Any help?
-
Aperture 3 - a catalogue of disasters.
OK, I have Aperture 3. ITried the Demo - it seemed fine so I plonked down for the upgrade. Here are the problems I have been having so far: • Faces seems to take an age to do anything. There have been times when I've entered a new person's name using
-
What is a service(name) when it comes to different devel style than repos?
hi *, let me describe the situation as it is now: SITUATION: now in ican 505 we are having many JCDs that act as gateways to the outside world e.g. we do have a component that is used for receiving IDOCs from an SAP System. we call it jcdIdocToQueue
-
Hello, I made a study regarding inbound communication in JCA. The assumption is about that resource adapter is effectively the client of the EJB container; so I implemented the JCA 1.0 resource adapter as it was a client. In detail: when I got a conn