Database adapter vs sql query

Hi all, I am developing a small SOA application using a synch BPEL and Database adapter. But I have some problems getting the database results this is the query
SELECT t1.Location, t1.ID, t2.quantity, t1.Name
FROM tblitem t1 JOIN tblorderitem t2 ON (t1.id = t2.itemid)
JOIN tblorder t3 ON (t2.orderid = t3.ID)
WHERE (t3.id = #Order_id)
ORDER BY t1.Location
which get a sorted list according to the Order_id parameter, this query works perfectly on sqlplus, but not in database adapter, Anyone knows why?

Hi Arik, I have managed to solve the problem. I don't actually understand why, but it is now solved. I am going to explain how I fixed the problem and I hope you or someone else can understand why.
I am using three tables each one contains this information
tblItem
ID NUMBER
Location NUMBER
tblOrderItem
ID NUMBER
ItemID NUMBER
OrderID NUMBER
Quantity NUMBER
tblOrder
ID NUMBER
And I changed the previous query to this
SELECT t1.Location, t1.ID, t2.quantity, t1.Name
FROM tblitem t1 JOIN tblorderitem t2 ON (t1.id = t2.itemid)
WHERE (t2.OrderID = #Order_id)
ORDER BY t1.Location
I think that I had redundant information adding tblOrder which is filtered by OrderID, when that field is already in tblOrderItem. I don't think this matters, because I can match as many tables as I want to make a bigger query. Anyway, If you know the answer, please let me know.
Thanks a lot.
Jaume.

Similar Messages

  • Database Adapter and SQL Server procedure issue

    Hello,
    I am using Jdev 11.1.1.7.0 and SQL Server 2005.
    In the Database Adapter configuration wizard, Specify Stored Procedure step, I choose the “GEACupax” schema and got the following error after a click on “Procedure Browse” button:
    com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'GEACUPAX.INFORMATION_SCHEMA.SCHEMATA'.
    The command Database Adapter tried to execute was:
    (from jdev log:) select schema_name from GEACUPAX.INFORMATION_SCHEMA.SCHEMATA order by schema_name;
    Note, the schema name has changed to uppercase. I think that is the problem. If I try this query in SQLDeveloper, it returns the same error. I can fix it changing the schema name to “GEACupax”. The case matters.
    Any ideas?
    Leandro.

    Vijay,
    Thanks for you reply.
    I figure out a related bug:
    Bug 12859472: Cannot browse store procedure in case-sensitive MS SQL Database
    There are two possible workarounds:
    1. Use a database name with capital letters
    2. Do not use stored procedures, but access the tables directly.
    The notes on the Bug ticket describes that the issue would be scheduled to be fixed in PS7 which is 11.1.1.8.
    Cheers!
    Leandro.

  • Error using Database addons with SQL query.

    I get a LabVIEW error when I provide the following SQL query to the NI database VI: ..vi.lib\addons\database\Connection.llb\Conn Execute.vi. 
    declare @SR_ID table ( script_result_id uniqueidentifier )
    insert into @SR_ID
    select script_result_id from SCRIPT_RESULT
    where script_result.software_name = '%s'
    SELECT distinct STEP_RESULT.STEP_TYPE
    FROM STEP_RESULT INNER JOIN @SR_ID s ON
    STEP_RESULT.SCRIPT_RESULT_ID = s.script_result_id
    The error is:
    Error -2146824584 occurred at NI_Database_API.lvlib:Rec Destroy - Connection.vi->Database_Query Database with flattened string reply.vi->ADUTS-RPT Query DB.vi->ADUTS-RPT Get Step Names.vi->ADUTS-RPT Top.vi
    Possible Reason(s): Exception occured in ADODB.Recordset: Operation is not allowed when the object is closed.
    The query works fine when given directly to my SQL server.
    Any ideas on this problem would be most appreciated.

    It looks like the bug is related to ADODB objects. I found a related KnowledgeBase article that was written about the same issue, but never published for some reason. Here's what it has to say about your error:
    "This error occurs when a query is run on the database that does not return any recordset data, such as a delete command.  In this case, when you encounter the DB Tools Fetch Recordset Data VI, the state of the recordset is "closed" and produces the error.
    To avoid the error, you can check for the state of the recordset and make sure that it isn't closed. To do this, use the DB Tools Get Properties VI and check the state from the properties cluster.  An additional, or alternate, check would be to check for the beginning of file and end of file properties.  If both BOF and EOF are both true, there is no data in the recordset.  
    If you open the example program, Database Fetching, you can see that they are using both of these checks.
    In versions of the toolset prior to version 1.0.2, these checks were built in.  This causes code without the checks to return this error if the toolset is updated from a previous version."
    Tim W.
    Applications Engineering
    National Instruments
    http://www.ni.com/support 

  • Database Adapter with sql server connection cannot import user tables

    Hi,
    In jdeveloper 11g, I tried to create a sql server database connection, i could create the connection, i could see the tables and navigate through the data in
    Database navigator section. But while trying to import the tables in the Database adapter to do polling operation, It displays only the system tables like this
    syscolumns (dbo)
    syscomments (dbo)
    sysdepends (dbo)
    sysfilegroups (dbo)
    sysfiles (dbo)
    sysforeignkeys (dbo)
    sysfulltextcatalogs (dbo)
    sysindexes (dbo)
    sysindexkeys (dbo)
    sysmembers (dbo)
    sysobjects (dbo)
    syspermissions (dbo)
    sysprotects (dbo)
    sysreferences (dbo)
    systypes (dbo)
    sysusers (dbo)
    I am not understanding this wierd bahaviour of jdeveloper.
    please advise.
    -Chaitu
    Edited by: chaitu123 on May 13, 2010 9:16 AM

    This is NOT related solely to the SOA Suite. The same behavior appears in the Connections Navigator.
    IMHO, this is related to how JDeveloper is parsing the .getMetaData() response.
    Scott
    Edited by: user8951683 on May 21, 2010 8:08 AM

  • Database Adapter Custom SQL

    Hi All,
    Is there any way that we can add the variables from BPEL process in custom SQL of database adapter.
    Example:
    I have a variable defined in BPEL process and I have assigned a value to that variable. And in invoke process accessing database adapter is having Custom Sql operation then how can I use the variable in custom sql?
    Any idea, please suggest.
    Regards,
    Sreejit

    Sreejit,
    You can assign/pass a value to your custom sql of DBAdapter like this.
    select from <tablename> where tname = #variablename*+
    ex: select * from emp where empno=#employeenum
    Use an assign/transformation activity and do the mapping from the actual variable to the input variable(shows 'employeenum' as its variable) of invoke activity which invokes the DBAdapter.
    I used this scenario extensively in my projects.
    Thanx,
    Sen

  • How to remove database name from SQL query

    We have an MS SQL server with several databases that are of the same schema but have different data.  We do this for testing different environments.  We are using Crystal reports for the first time and we are having trouble changing the database location in the designer.  If update the data source location to the same database server, but different database name, the data still comes from the original database used when creating the report.  We look at the SQL query and it contains the database name and does not change when updating the data source.  Therefore the data always comes from the database used when originally creating the report.
    How can I remove the database name from the SQL query so the proper database is used when testing the report?

    Hi C F
    Please ensure you have followed the procedure mentioned below:
    In Crystal Reports, there are two ways to set the location of the data source your report points to, depending on your connection type.
    For ODBC and Native Connections:
    1. On the 'Database' menu, click 'Set Datasource Location'.
    2. In the 'Current Data Source' section, click the data source to be changed. You must click each individual table in the data source one by one. If the data source is a stored procedure you will not see individual tables.
    NOTE     In Crystal Reports 10, XIR1, and XIR2, if you are mapping from a data source such as a stored procedure where the report designer can not determine which fields should be mapped automatically, you will see a 'Mapping' dialog box where you can manually map fields, as in the procedure cited above.
    3. In the 'Replace with' section, click the data source you want the report to use.
    4. Click 'Update'.
    5. Close the 'Set Datasource Location' window.
    The report now points to the new location.
    For Native Connections Only:
    1. On the 'Database' menu, click 'Set Datasource Location'.
    2. In the 'Current Data Source' section, click 'Properties' to expand it and right-click 'Database Name: <path to database>'.
    3. Click 'Edit' and then type the path to the
    new data source location.
    4. Close the 'Set Datasource Location' window.
    The report now points to the new location.
    Regards
    Girish

  • Search for tablenames in the database using native sql query script

    How do i search for the names of the tables in the database using select statement? I do not know the names of the tables but I know the name of the database and i do not have the sys priviliges.
    thanks
    SS

    SELECT owner, table_name
    FROM all_tables;

  • How to backup database using sql query?

    Hello,i'm student, i'm researching oracle database,i want to backup database that using sql query (like backup query in SQL SERVER) ,how to do that ??
    Thank!

    No, database backups cannot be done from within the database.
    Commands for backups are outside of the database.
    See the "2 Day DBA Guide" http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/toc.htm
    and the "Backup and Recovery Users's (actually Adminsitrator's) Guide : http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/toc.htm
    Hemant K Chitale

  • SQL query with Java Server Pages

    Hey,
    I'm trying to read some information from database with SQL Query. How I can put the parameter that I get from previous *.jsp page to SQL query?
    Technologies that I use are WML, JSP and MySQL.
    I can get the parameter by method getParameter() and it is correct.
    But how to but the requested parameter into sql query and complete the sql query?
    Should I read it to some variable before putting it to sql query?
    */ this works fine */
    out.println("<p>periodi"+request.getParameter("periodi"+"loppu</p>");
    /* this doesn't work */
    ResultSet tulokset = lause.executeQuery("select * from kurssi where periodi='+request.getParameter("periodi")+'");
    /* this doesn't work */
    String periodi=request.getParameter("periodi");
    ResultSet tulokset = lause.executeQuery("select * from kurssi where periodi='periodi' '");
    Thanks,
    Rampe

    Hey,
    I'm trying to read some information from database
    se with SQL Query. How I can put the parameter that I
    get from previous *.jsp page to SQL query?
    Technologies that I use are WML, JSP and MySQL.
    I can get the parameter by method getParameter()
    () and it is correct.
    But how to but the requested parameter into sql
    ql query and complete the sql query?
    Should I read it to some variable before putting it
    it to sql query?
    */ this works fine */
    out.println("<p>periodi"+request.getParameter("periodi"
    "loppu</p>");
    /* this doesn't work */
    ResultSet tulokset = lause.executeQuery("select * from
    kurssi where
    periodi='+request.getParameter("periodi")+'");
    /* this doesn't work */
    String periodi=request.getParameter("periodi");
    ResultSet tulokset = lause.executeQuery("select *
    * from kurssi where periodi='periodi' '");
    Thanks,
    RampeTry this
    ResultSet tulokset = lause.executeQuery("select * from kurssi where periodi=" + "'" +request.getParameter("periodi")+"' " );this should work

  • Dynamic where clause in Database Adapter, or workaround?

    Hello friends,
    Is there any way to change where clause in Database Adapter (DA) dynamically.
    For e.g. i do have Database Adapter with sql statement: select col1,col2 from my_table. Originally i have many parameters which are not mandatory so instead of creating where clause in DA like:
    select col1, col2 from my_table where+
    *((#p_col_1 is not null and #p_col_1=col1) or #p_col_1 is null)*
    and ...
    and  ((#p_col_n is not null and #p_col_n=col_n) or #p_col_n is null)
    i would like to create a where clause dynamically depend on what parameters are not empty or receive where clause as parameter. Is it possible? Are there any others workarounds you can suggest?
    will appreciate any thoughts...

    Thanks Deepa for the links, their where quite helpful. And i must admit this partially answers my question (at least example i provided).
    However - how about if i'd like to use LIKE clauses instead of =, or IN or NOT IN? e.g:
    select col1, col2 from my_table where+
    ((#p_col_1 is not null and #p_col_1 LIKE col1) or #p_col_1 is null)
    and ...
    and ((#p_col_n is not null and col_n IN #p_col_n) or #p_col_n is null)
    Is it possible?
    thanks in advance

  • Sql query using EJB

    I'm trying to adapt my sql query i use for php in order to return zipcodes using a radial search.
    This is my query that i use in php:
    $strSql2 = "SELECT * FROM Zips where (DEGREES(ACOS(SIN(RADIANS(" . $this->lat . ")) * SIN(RADIANS(lat)) + COS(RADIANS(" . $this->lat . ")) * COS(RADIANS(lat)) * COS(RADIANS(" . $this->lon . " - lon)))) * 69.090909) <= " . $distance;I need to adapt this to work for my finder method in my jaws.xml file, here is what i have so far, i know it doesn't work, especially with the < sign in there ;)
             <finder>
               <name>findByDistance</name>
               <query>(DEGREES(ACOS(SIN(RADIANS(" . $this->lat . ")) * SIN(RADIANS(lat)) + COS(RADIANS(" . $this->lat . ")) * COS(RADIANS(lat)) * COS(RADIANS(" . $this->lon . " -lon)))) * 69.090909) <= " . $distance</query>
               <order>zipcode ASC</order>
             </finder>          Thanks for your help guys.

    Hello,
    If the ">" or "<" are creating the problem then u can use the following approach. Here i am explaing it with an example:
    EJB QL statements are declared in XML deployment descriptors. XML uses the greater than (�>�) and less than (�<�) characters as delimiters for tags, so using these symbols in the EJB QL statements will cause parsing errors unless CDATA sections are used. For example, the following EJB QL statement causes a parsing error, because the XML parser cannot distinguish the use of the �>� symbol from a delimiter to a XML tag:
    <query>
    <query-method>
    <method-name>findWithPaymentGreaterThan</method-name>
    <method-params>java.lang.Double</method-params>
    </query-method>
    <ejb-ql>
    SELECT OBJECT( r ) FROM Reservation r
    WHERE r.amountPaid > ?1
    </ejb-ql>
    </query>
    To avoid this problem, the EJB QL statement should be placed in a CDATA section:
    <query>
    <query-method>
    <method-name>findWithPaymentGreaterThan</method-name>
    <method-params>java.lang.Double</method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[
    SELECT OBJECT( r ) FROM Reservation r
    WHERE r.amountPaid > 300.00
    ]]>
    </ejb-ql>
    </query>
    The CDATA section takes the form <![CDATA[ literal-text ]]>. When an XML processor encounters a CDATA section it doesn�t attempt to parse the contents enclosed by the CDATA section, instead the parser treats it as literal text .

  • How to numberformat when using sql:query alogn with c:forEach JSTL tags

    Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
    Here is my jsp code
    <sql:query..../>
    <c:forEach var="row" items="${queryResults.rows}">
    <tr>
    <td><c:out value="${row.COL1}" /></td>
    <td><c:out value="${row.COL2}" /></td>
    </tr>
    </c:forEach>
    Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
    how can i format them to 1,000 , 10,1000 , 100,000 etc

    It is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
    I presume you discovered the JSTL <fmt:formatNumber> tag?

  • SOA - Database Adapter push data to BAM

    I would like to create an SOA application to pull data from an Oracle Database and push it Oracle BAM.
    In the past I've done this by using the "Polling for new or changed records in a table" from the Database Adapter to pull new data from the database. However, I wish to know if it is possible for me to somehow configure the adapter to execute a query on the database, grab the results and push them through the Mediator and onto the BAM adapter.
    The main point here is that there is no Table or View on the database to supply the data. The data is created dynamically as a query result when / if the database adapter runs the query on the database.
    This needs to happen periodically (as with the polling for changes method).
    Is this possible?

    Hi
    I believe the below option will help you.
    1.Create a BPEL process and inside that use the DB adapter to execute the query and fetch the data and push the same to BAM through the BAM Adapter.
    2.Schedule the BPEL process with Quartz Scheduler(default option provided by Oracle BPEL) to run periodically as per your requirement.
    Regards
    Albin I

  • How to set fetchsize of sql Query when using Database Adapter.

    Hi All,
    I am using DatabaseAdapter to connect to database and retriving huge amount of data.For improvement in the performance I want to set the "fetchsize" of sql query. I know fetchsize can be preset in Java using Jdbc 2.0 API.Please let me know how to set this value in BPEL when using DBAdapter?
    Thanks
    Chandra

    I talked to the developer of the db adapter - and he told me this feature will be available in BPEL PM 10.1.3 (which is supposed to be production later this year, and a public beta soon). If this is an emergency I would recommend going throug Oracle support and have them file an enhancement for 10.1.2.0.2
    hth clemens

  • Build dynamic SQL query in Database Adapter.

    Hi All,
    I have a requirement to build dynamic sql query at Database Adapter.
    My BPEL process is getting search spec as input from siebel. I need to process this searchspec in BPEL and need to build the SQL query dynamically at Database Adapter to fetch the records from DB.
    it goes like this....
    1. Sieble Search Spec: city1 OR city2 OR city3 OR city4 .....
    I need to build query as
    select * from S_ADDR_PER where city like 'city1' OR city like 'city2' OR city like 'city3' OR city like 'city4' ......
    2. Siebel Search spec: city1 AND country1 AND state1....
    I need to build query as
    Select * from S_ADDR_PER where city like 'city1' AND country like 'country1' AND state like 'state1' ....
    3. Siebel Search spec: state
    I need to build query as
    select * from S_ADDR_PER where state like '%state%';
    Is it feasible in Database Adapter? if its Yes.
    Any guidelines to achieve this?
    Thank you
    Chandra

    Hi All,
    I have a requirement to build dynamic sql query at Database Adapter.
    My BPEL process is getting search spec as input from siebel. I need to process this searchspec in BPEL and need to build the SQL query dynamically at Database Adapter to fetch the records from DB.
    it goes like this....
    1. Sieble Search Spec: city1 OR city2 OR city3 OR city4 .....
    I need to build query as
    select * from S_ADDR_PER where city like 'city1' OR city like 'city2' OR city like 'city3' OR city like 'city4' ......
    2. Siebel Search spec: city1 AND country1 AND state1....
    I need to build query as
    Select * from S_ADDR_PER where city like 'city1' AND country like 'country1' AND state like 'state1' ....
    3. Siebel Search spec: state
    I need to build query as
    select * from S_ADDR_PER where state like '%state%';
    Is it feasible in Database Adapter? if its Yes.
    Any guidelines to achieve this?
    Thank you
    Chandra

Maybe you are looking for

  • Need to send XML msg to TP using B2B, but format should be Orcl XML Gateway

    Current Interface: ================== We have an EBS 11.5.10 with XML Gateway. Actively we were exchanging XML data with 5 trading partners (different application maintained by 3rd party) using EBS XML Gateway. XML Gateway uses OAG Format (attached t

  • Driver update configuration error

    When i try to update my driver software for my iphone when registering to a non apple computer, it says that one of the drivers for my device cannot be installed. when i go into properties it says my device is not configured correctly so i cannot upd

  • My CS3 spry vertical menu does not maintain properties on web.

    My first web site is available at www.edgarcemetery.com. I used Dreamweaver, and it is hosted through Yahoo Small Business, I am having trouble getting the properties of the Spry Menu Bar to display appropriately in Internet Explorer 7, on Windows XP

  • Why does my iPad 3rd gen keep saying "not charging"?

    My iPad (3rd gen) is frequently saying "not charging" when I plug it into my computer or ac adapter. I'm using Apple cords and adapters, too!

  • Premiere Pro Title Templates Missing

    I am trying to download the Preset Title Templates for Premiere Pro. I click on the link in Premiere and get a "Webpage Cannot Be Found" error. Is there a correct link available?