JDBC querying 2 tables problem

Hello. I'm trying to work on a CD Catalog Java Program. Here's the problem description :
I have one table for Recordings. I have another table for Artists. I want to do a System.Out.Println() for my entire collection in the form :
Artist - Recording Title
So, I'm sweeping through the Recordings_Table (SELECT * FROM Recordings_Table). That works great.
As I'm pulling off each title I want to call a getArtist() method to get the Artist_Name based on the Artist_ID found in the Recordings_Table.
try
rs = statement.executeQuery( "SELECT * FROM Recordings" );
ResultSetMetaData rsmd = rs.getMetaData( );
for ( int i = 1; i < ( rsmd.getColumnCount( ) + 1 ); i++ )
String columnName = rsmd.getColumnName( i );
System.out.println( "Column name " + columnName );
while ( rs.next( ) )
String aName = getArtistName( rs.getString ( "RecordingArtistID" ) );
System.out.println( rs.getString( "RecordingArtistID" ) );
System.out.println( rs.getString( "RecordingTitle" ) );
catch ( SQLException ex )
System.out.println( "SQLException" );
ex.printStackTrace( );
private String getArtistName( String artistID )
System.out.println( "AID = " + artistID );
try
results = statement.executeQuery( "SELECT RecordingArtistName FROM Recording_Artists WHERE RecordingArtistID=1" );
while ( results.next( ) )
System.out.println( results.getString( "RecordingArtistName" ) );
I get the following error :
java.sql.SQLException: ResultSet is closed
It appears it has something to do with opening the one result set with all the recording titles and then trying to open another result set on the artist_table. Sorry for the format of the code... I know it looks bad in here.

I tried putting the query in one SQL Statment... however, I get an error and I have no clue what is wrong with the sql.
Yes I'm aware of the lousy names... the RecordingTable is called Recordings.
rs = statement.executeQuery( "SELECT Recordings.*, Recording_Artists.RecordingArtistName FROM Recordings WHERE Recordings.RecordingArtistID = Recording_Artists.RecordingArtistID" );
The error I get is :
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
I cut and paste the string into SQL View in MS Access and it seems to work like a champ. Any clues?

Similar Messages

  • Dbms_sql  in a different schema from query table-error  ** ORA-00942

    Oracle Experts,
    I think I am having problems with using DBMS_SQL in which the function was created in one schema and the query table was created in a different schema.
    We have 2 schemas: S1, S2
    We have 2 tables:
    T1 in Schema S1
    T2 in Schema S2
    We have a function F1 created by DBA in schema S1 that uses the dbms_sql as:
    CREATE OR REPLACE FUNCTION S1.F1(v1 in VARCHAR2) return NUMBER IS
    cursor1 INTEGER;
    BEGIN
    cursor1 := dbms_sql.open_cursor;
    dbms_sql.parse(cursor1, v1, dbms_sql.NATIVE);
    dbms_sql.close_cursor(cursor1);
    return (0);
    EXCEPTION
    when others then
    dbms_sql.close_cursor(cursor1);
    return (1) ;
    END;
    I am using jdeveloper 11G. We have an Oracle DB 11g.
    We have a java program which uses jdbc to talk to our Oracle DB.
    Basically, in my java program, I call function F1 to check if the query is valid.
    If it is, it returns 0. Otherwise, returns 1:
    oracle.jdbc.OracleCallableStatement cstmt = (oracle.jdbc.OracleCallableStatement) connection.prepareCall ("begin ? := S1.F1 (?); end;");
    cstmt.registerOutParameter (1, java.sql.Types.INTEGER);
    cstmt.setString(2, "Select * from S2.T2");
    cstmt.execute ();
    Since the table that I run the query is T2, created in different schema than F1 was created in, I have the error:
    ** ORA-00942: table or view does not exist
    So my questions are these:
    - I am using Oracle DB 11g, if I run the query on a table that created in a different schema from the one that the function (which uses dbms_sql) was created in, I would get the error ORA-00942?
    - If I runs the query on table T1 in the same schema as the function F1, would I have the same problem(The reason I ask is I cannot create any table in schema S1 because the DBA has to do it; I am not a DBA)
    - This is not a problem, but a security feature because of SQL injection?
    - How to resolve this issue other than creating the table in the same schema as the function that utilizes DBMS_SQL?
    Regards,
    Binh

    Definer rights (default) stored objects run under owner's security domain and ignore role based privileges. So regardless what user you are logged in as, function S1.F1 always executes as user S1 and ignores user S1 roles. Therefore exeuting statement within S1.F1:
    Select * from S2.T2requires user S1 to have SELECT privilege on S2.T2 granted to S1 directly, not via role.
    SY.

  • JDBC query in the course of a separate EJB transaction

    Hi all,
    I am implementing a web application that let user upload file and send it to the backend for processing,which involves EJB level transaction(many read+write operations),say transaction L .The processing time may last for 10 minutes. Meanwhile the user can view the history of the files he uploaded and CURRENT STATUS of the file he submitted for processing,we call it file upload history summary (they are from direct JDBC query to the upload history table,say table U in the database,since they are read only data).
    My problem is: the user can not see his LATEST file upload status UNTIL the backend processing transaction is completed,although the row for latest file he just submits in Table U was created during the course of the transaction L by an EntityBean UEJB.
    I am using Jboss server,do u guys have any idea so that I can see the new file status once it's created by the UEJB even before the transaction L is completed?Thanks

    You can achieve this by using JMS and MDB. Because once your file is uploaded, the server is busy in loading the data to the database. So it is not sending you back the response as you are doing a synchronous communication. You have to use Asynchronuous communication to achieve this. This way the client will not wait for the response and the transaction to finish.
    While uploading you a send the file as a message object using JMS and MDB. Let the MDB call the other EJB to load the data to the database. Then you can refresh the status browser automatically in certain periods to retrieve data using other EJB like simple access. The browser will automatically submit itself and get the data from EJB while the other EJB uploading the data to the database.
    Hope this helps. If you are still not clear write again. I will explain it again.
    Thanks
    Amit

  • CF 10 getting random resets : Detail: [Macromedia][SQLServer JDBC Driver]A problem occurred when attempting to contact the server (Server returned: Connection reset).

      These resets appear to coincide with a clearing of the cached queries for the DSN from memory, breaking all my sub queries that try to use the initial cached one.  I am grasping at straws to discover the reset culprit, the DSN tests always show OK, there is not packet loss at the switch level.  If anyone has some suggestions, I am all ears!
      The resets are completely random and under no load.  My sql 2008 r2 box is set to unlimited connections.
    An example of a DSN setup is :
    Maintain Connections [x]
    String Format [ ]
    Max Pooled Statements 100
    Timeout 20 Interval 7
    Query Timeout 0
    Login Timeout 30
    CLOB [ ]
    BLOB [ ]
    Long Text Buffer 64000
    Blob Buffer 64000
    Validate Connection [ ]
    I am running the following :
    CF Enterprise 10,0,13,287689
    Tomcat 7.0.23.0
    Ubuntu 1204 x64
    Java VM 20.4-b02
    Java 1.6 (Sun Microsystems Inc)
      I have seen it suggested to uncheck the maintain connections advanced options but this doesn't seem like a good approach to the problem and will cause more stress on the sql box IMHO.
      I have also seen it suggested to enable Validate Connection but documentation on this is a bit sparse...
    Here are more examples of the initial reset error and then the subsequent cache related errors :
    Database Error Information:
    Native Error Code: 0
    SQL State: 08S01
    Query Error: [Macromedia][SQLServer JDBC Driver]A problem occurred when attempting to contact the server (Server returned: Connection reset). Please ensure that the server parameters passed to the driver are correct and that the server is running. Also ensure that the maximum number of connections have not been exceeded for this server.
    Custom Error Code: 08S01
    Database Error Information:
    Native Error Code: 0
    SQL State: n/a
    Query Error:
    Query Of Queries runtime error.
    Table named GlobalDetails was not found in memory. The name is misspelled or the table is not defined.
    Custom Error Code: n/a
    Thanks in advance to anyone who has a suggestion.

    Hi, could DBA check MS SQL Server connection logs???
    May be server has some limits (for example sessions, memory and e.t.c.)

  • How to use a jdbc query result to redirect to a variable html page

    uh, my problem is that i'm making a servlet which should redirect to a variable html page based on jdbc query (I'm really sorry if this is not the correct forum to post it, but since it's jdbc i thought it was).
    Anyway, the problem is that when a string say, "mystring" is equal to the value in a column, say "column1" of the database then page should redirect to "mystring.html".
    Is this possible, if so then how?
    and if not then is there any other way to solve my problem?
    please, help!!
    thanks in advance.

    uh, since i've already asked man, please gimme an answer if you know, it'll be appreciated.
    OK, HERE'RE THE DETAILS:(as you requested them)
    i have an html page where there's a textfield say "t1", the value of that text field is sent to the servlet which compares the value of the field with the value in Database, say "db1" in column say "column1".
    if there's a value in the column matching the value inputted in the textfield, then i need the servlet to redirect to an html page of the same name as inputted in the textfield. Hope that helps you understand.....
    thanks in advance.......

  • How to call pl/sql stored procedure in JDBC query dialogbox

    Hi,
    how to call pl/sql stored procedure in JDBC query dialogbox(reports 9i) .
    Cheers,
    Raghu

    please refer : Re: problem If you have more doubts, please ask in that question.

  • JDBC query theme in a JSP page

    Hi, everyone
    I tried to write JDBC query theme in a JSP page at MapViewer, but it did not work.
    The following is the codes.
    1.JDBC theme in a map request in XML
    <theme name="jdbc_theme_contour">
    <jdbc_query
    datasource="spatial10g"
    jdbc_srid="8703"
    spatial_column="geom"
    render_style="C.RED">
    Select geom from contour where time='01-JUL-07'
    </jdbc_query>
    </theme>
    2. JDBC theme in a JSP request.
    "<theme name=\"jdbc_theme_contour\" >\n" +
    " <jdbc_query \n" +
    " jdbc_srid=\"" + srid + "\"\n" +
    " datasource=\"" + dataSource + "\"\n" +
    " spatial_column=\" geom \"\n" +
    " render_style=\"C.RED\" >\n" +
    " SELECT geom from contour where time='01-JUL-07' \n" +
    " </jdbc_query> \n" +
    " </theme> \n" +
    I do not know whether the second form is right or not. I did not display the JDBC query in MapViewer. Does anyone know the second form is right? or Maybe give me a right form in a JSP request. (contour is a table , geom is the column of geometry attribute in contour)
    Gengsheng

    Hi
    Here is the map request in JSP
    // Construct a map request
    mapRequest = "xml_request=" +
    "<?xml version=\"1.0\" standalone=\"yes\" ?>\n" +
    "<map_request \n" +
    // " title=\"" + title + "\"\n" +
    " datasource=\"" + dataSource + "\"\n" +
    " basemap=\"" + basemap + "\"\n" +
    " width=\"" + width + "\"\n" +
    " height=\"" + height + "\"\n" +
    " bgcolor=\"#FFFFFF\" >\n" +
    " format=\"PNG_URL\" >\n" +
    " <center size=\"" + size + "\">\n" +
    " <geoFeature>\n" +
    " <geometricProperty typeName=\"center\">\n" +
    " <Point>\n" +
    " <coordinates>\n" +
    " " + cx + ", " + cy + "\n" +
    " </coordinates>\n" +
    " </Point>\n" +
    " </geometricProperty>\n" +
    " </geoFeature>\n" +
    " </center>\n" +
    "<themes> \n" +
    (flood.equals("true")?
    ("<theme name=\"jdbc_theme_contour\" >\n" +
    " <jdbc_query \n" +
    " jdbc_srid=\"" + srid + "\"\n" +
    " datasource=\"" + dataSource + "\"\n" +
    " spatial_column=\"GEOM\"\n" +
    " render_style=\"C.RED\" >\n" +
    " SELECT * from contour where time='01-JUL-07' \n" +
    " </jdbc_query> \n" +
         " </theme> \n") : "") +
         (waterdepth.equals("true")?
         (" <theme name=\"FLOOD.LINKS\" >\n" +
         " </theme> \n") : "") +
         " <theme name=\"net_theme\" user_clickable=\"false\"> \n" +
    " <jdbc_network_query \n" +
    " network_name=\"" + networkName + "\"\n" +
    " network_level=\"1\" \n" +
    " jdbc_srid=\"" + srid + "\"\n" +
    " datasource=\"" + dataSource + "\"\n" +
    (showlinks.equals("true")?
    (" link_style=\"L.CRM_SROADS\"\n") : "") +
    (showlinks.equals("true") && showdir.equals("true")?
    (" direction_style=\"M.IMAGE105_BW\"\n" +
    " direction_position=\"0.75\"\n" +
    " direction_markersize=\"" + dirsize + "\"\n") : "") +
    (showlinks.equals("true") && showlklabels.equals("true")?
    (" link_labelstyle=\"" + lklbstyle + "\"\n" +
    " link_labelcolumn=\"link_id\"\n") : "") +
    (shownodes.equals("true") ?
    (" node_style=\"M.CITY HALL 4\"\n" +
    " node_markersize=\"" + nodesize + "\"\n") : "") +
    (shownodes.equals("true") && showndlabels.equals("true")?
    (" node_labelstyle=\"" + ndlbstyle + "\"\n" +
    " node_labelcolumn=\"" + ndlbcolumn + "\"\n") : "") +
    (showpath.equals("true") ?
    (" path_ids=\"" + pathid + "\"\n" +
    " path_styles=\"L.PH\"\n") : "") +
    " asis=\"false\"></jdbc_network_query> \n" +
    " </theme> \n" +
    (runanalysis.equals("true") &&
    (algorithm.equals("DIJKSTRA") || algorithm.equals("ASEARCH")) ?
    (" <theme name=\"spath_theme\" user_clickable=\"false\"> \n" +
    " <jdbc_network_query \n" +
    " network_name=\"" + networkName + "\"\n" +
    " network_level=\"1\" \n" +
    " jdbc_srid=\"" + srid + "\"\n" +
    " datasource=\"" + dataSource + "\"\n" +
    " analysis_algorithm=\"" + algorithm + "\"\n" +
    " shortestpath_style=\"L.DPH\"\n" +
    " shortestpath_startnode=\"" + startnode + "\"\n" +
    " shortestpath_endnode=\"" + endnode + "\"\n" +
    " shortestpath_startstyle=\"M.STAR\"\n" +
    " shortestpath_endstyle=\"M.CIRCLE\"\n" +
    " asis=\"false\"></jdbc_network_query> \n" +
    " </theme> \n") : "") +
    "</themes>\n" +
    "</map_request>\n";
    in this request, other themes and JDBC network query theme work except the JDBC query theme. I guess the style or format in the following are not right.
    " spatial_column=\" geom \"\n" +
    " SELECT geom from contour where time='01-JUL-07' \n" +
    Anyway, I hope you can give me instructions.
    Gengsheng

  • Autonomous Trigger / Mutating Table Problem

    We have a specific problem in one of our applications being developed where by the database needs to enforce a specific business requirement.
    We need to use a database trigger to enforce some data integrity which involves more than one table as such cannot use standard constraint. The integrity has to be maintained in the database as the DML statements may be coming from a Java application or PL/SQL code as such we need the logic all in one place.
    The problem being that within the trigger we need to examine the state of the table the trigger is associated with as well as one other table. Obviously using a trigger on a table that is being affected by DML statements causes the dreaded mutating table problem.
    One suggested solution to this was to make the trigger or the code the trigger called autonomous. This allows the trigger to execute by only showing the trigger the original state of the table before any of the DML statements have affected it.
    The problem is this seems to work for single row DML statements but not for multi row DML statements. In multi row the trigger only sees the original state of the table, not the state of the table plus the changes made by any other actions in the same DML statement.
    Below I have shown an example of what I'm seeing.
    I have grossly simplified the example code below to only refer to a single table and use stupidly simple logic
    I do realise i appear to be implementing uniqueness in my own PL/SQL code, this is purely for the example.
    CREATE TABLE mutate_test
    id INTEGER NOT NULL,
    value VARCHAR2(255) NOT NULL
    ALTER TABLE mutate_test ADD CONSTRAINT pk_mutate_test PRIMARY KEY(id);
    ALTER TABLE mutate_test ADD CONSTRAINT ck_mutate_test CHECK (value = UPPER(value));
    CREATE OR REPLACE FUNCTION duplicate_found(in_value IN mutate_test.value%TYPE) RETURN BOOLEAN IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    v_value_found INTEGER;
    BEGIN
    SELECT COUNT(*)
    INTO v_value_found
    FROM mutate_test
    WHERE value = in_value;
    IF v_value_found > 0 THEN
    RETURN TRUE;
    ELSE
    RETURN FALSE;
    END IF;
    END;
    CREATE OR REPLACE TRIGGER tr_mutate_test BEFORE INSERT OR UPDATE ON mutate_test
    FOR EACH ROW
    BEGIN
    IF duplicate_found(:new.value) = TRUE THEN
    RAISE_APPLICATION_ERROR(-20000,'Duplicate value found');
    END IF;
    END;
    INSERT INTO mutate_test (id,value) VALUES (1,'CLIFF');
    INSERT INTO mutate_test (id,value) VALUES (2,'SULA');
    COMMIT;
    SELECT * FROM mutate_test;
    -- Should fail as row 1 already has a value of CLIFF
    INSERT INTO mutate_test (id,value) VALUES (3,'CLIFF');
    COMMIT;
    SELECT * FROM mutate_test;
    -- Should fail as row 1 is already set to CLIFF
    UPDATE mutate_test SET value = 'CLIFF' WHERE id = 2;
    COMMIT;
    SELECT * FROM mutate_test;
    UPDATE mutate_test SET value = 'CLIFFORD' WHERE id = 1;
    COMMIT;
    SELECT * FROM mutate_test;
    INSERT INTO mutate_test (id,value) VALUES (3,'RONNY');
    INSERT INTO mutate_test (id,value) VALUES (4,'TIM');
    INSERT INTO mutate_test (id,value) VALUES (5,'MONIQUE');
    COMMIT;
    SELECT * FROM mutate_test;
    -- Wanted result would be row 1 would be updated from CLIFFORD to CLIFF
    -- and the others raise errors, or all of them raise errors.
    UPDATE mutate_test SET value = 'CLIFF' WHERE id IN (1,3,4);
    COMMIT;
    SELECT * FROM mutate_test;

    This is all from a University application that deals with eLearning.
    Shell = Mapping from the system to an external eLearning application, ie: unique id of the Blackboard course shell, or WebBoard board.
    Term = Academic term
    Sector = University sector, ie: Higher Education, TAFE, etc..
    Resource = eLearning tool, ie: Blackboard, WebBoard, etc..
    Resource Level = Whether the resource is being offered at a Course or Program level
    Resource Mapping = Association of a resource to shell
    What we are trying to achieve is that shells cannot be used across sector boundaries.
    The real table structure is (grossly simplified again)
    CREATE TABLE sector (sector_pk INTEGER PRIMARY KEY);
    CREATE TABLE sector_pattern (sector_pk INTEGER REFERENCES sector(sector_pk), pattern CHAR(2) NOT NULL UNIQUE CHECK (pattern = UPPER(pattern)));
    CREATE TABLE term (term_pk INTEGER PRIMARY KEY, term CHAR(4) NOT NULL UNIQUE CHECK (term = UPPER(term)));
    CREATE TABLE resource_level (resource_level_pk INTEGER PRIMARY KEY, term_pk INTEGER REFERENCES term(term_pk));
    CREATE TABLE shell_detail (shell_detail_pk INTEGER PRIMARY KEY);
    CREATE TABLE resource_mapping (resource_mapping INTEGER PRIMARY KEY, resource_level_pk INTEGER REFERENCES resource_level(resource_level_pk), shell_detail_pk INTEGER REFERENCES shell_detail(shell_detail_pk));
    Based on the Ask Tom article linked I'd liked to use a MATERIALIZED VIEW on the following query
    SELECT DISTINCT rm.shell_detail_pk,sp.sector_pk
    FROM resource_mapping rm, resource_level rl, term t, sector_pattern sp
    WHERE rm.resource_level_pk = rl.resource_level_pk
    AND rl.term_pk = t.term_pk
    AND SUBSTR(t.term,3,2) = sp.pattern;
    Then apply a UNIQUE constraint on that VIEW.
    But I'm receiving a
    SQL Error: ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    I'm not sure how to create the MATERIALIZED VIEW LOG entries for the above VIEW.
    Any ideas anyone? ;)
    Need to do some more reading and research but as Tom says
    "I'm asking around about the future of "SQL" as far as enhancments go like that
    (will update when I get some feedback), but -- you are not limited to triggers
    (in fact, I would avoid triggers as it is virtually IMPOSSIBLE to implement
    cross row/cross object constraints with them!!!! at least correctly)"
    So I think i'll give up on the TRIGGER approach as it doesn't meet our requirements.

  • Cannot query tables in remote database

    Hi, I have looked around for similar topics but have not found anything that would be close to my problem. I created a public link to a remote database from my portal database, it is a public link and I can query tables in the remote database just fine when I am on the sqlplus prompt. When I try to create a report, or a dynamic page, it lets me go through the wizard steps ok, however when I run it as a portlet or just run it as a report/page it does not seem to be able to see the query. Below is the response I get from running it as a portal. I am logged in as portal30.
    ORA-01017: invalid username/password; logon denied
    ORA-02063: preceding line from C2K (WWV-11230)
    Failed to parse as PORTAL30_PUBLIC - select * from populate@c2k (WWV-08300)
    The preference path does not exist:
    ORACLE.WEBVIEW.PARAMETERS.1320061995 (WWC-51000)
    The preference path does not exist:
    ORACLE.WEBVIEW.PARAMETERS.1320061995 (WWC-51000)
    Error: Unable to execute query (WWV-10201)
    Please help, I have tried everything from public to private synonyms for the linked tables and it just does not work. I am using the most recent version of portal that came with ias 1.0.2.2.0

    Actually I solved my problem, it looks like I should have used the db link utility with the portal, I linked the databases on the sqlplus command line and it seems like that was the issue.

  • Reg:Error in JDBC Lookup Table

    Hi All,
    My actual requirement is,A project ID is being triggered to PI which will pull the data from the database(SQL Server 2000) ,from different tables and it has to post to file.Receiver side I will be using the File Adapter.
    For this I am using JDBC Lookup table through an User Defined function.
    // code
    String Query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet =  null;
    //Build the Query String
      Query =  "Select proj_id, proj_short_name from PROJECT where proj_id = '"proj_id[0]"'";
    try{
    channel = LookupService.getChannel("bs_test" ,"cc_test");
    //Get a system accessor for the channel. As the call is being made //to an DB, an DatabaseAccessor is obtained.
    accessor = LookupService.getDataBaseAccessor(channel);
    //Execute Query and get the values in output
    resultSet = accessor.execute(Query);
    Iterator rows = null;
    rows = resultSet.getRows();
    while(rows.hasNext())
       Map rowMap = (Map)rows.next();
    //  String  proj_id = rowMap.get("proj_id");
    //  String project_name = rowMap.get("proj_short_name");
    result.addValue((String)rowMap.get("proj_id "));
    result.addValue((String)rowMap.get("project_short_name "));
    //result.addValue(proj_id);
    //result.addValue(project_short_name);
    catch(Exception ex)
    result.addValue(ex.getMessage());
    finally{
    try{
    if (accessor!=null) accessor.close();
    catch(Exception e)
    result.addValue(e.getMessage());
       //@@end
    While testing in test tab of Message Mapping,I am getting the value as 'NULL' for the project id  and am not able to see the other field.
    Please suggest me in this.
    Thanks in Advance,
    Lavanya.B

    Hi All,
    My actual requirement is,A project ID is being triggered to PI which will pull the data from the database(SQL Server 2000) ,from different tables and it has to post to file.Receiver side I will be using the File Adapter.
    For this I am using JDBC Lookup table through an User Defined function.
    // code
    String Query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    //Build the Query String
    Query = "Select proj_id, proj_short_name from PROJECT where proj_id = '"proj_id[0]"'";
    try{
    channel = LookupService.getChannel("bs_test" ,"cc_test");
    //Get a system accessor for the channel. As the call is being made //to an DB, an DatabaseAccessor is obtained.
    accessor = LookupService.getDataBaseAccessor(channel);
    //Execute Query and get the values in output
    resultSet = accessor.execute(Query);
    Iterator rows = null;
    rows = resultSet.getRows();
    while(rows.hasNext())
    Map rowMap = (Map)rows.next();
    result.addValue((String)rowMap.get("proj_id "));
    result.addValue((String)rowMap.get("project_short_name "));
    catch(Exception ex)
    result.addValue(ex.getMessage());
    finally{
    try{
    if (accessor!=null) accessor.close();
    catch(Exception e)
    result.addValue(e.getMessage());
    //@@end
    While testing in test tab of Message Mapping,I am getting the value as 'NULL' for the project id and am not able to see the other field value.
    Output:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:mt_test_recv xmlns:ns0="http://xxxx">
    <proj_id>null</proj_id>
    <proj_short_name />
    </ns0:mt_test_recv>
    Please suggest me in this.
    Thanks in Advance,
    Lavanya.B
    Edited by: Lavanya Balanandham on Dec 5, 2008 6:51 AM

  • SQL*PLUS help to query tables

    Is it possible to query tables of other users from a dba account?
    My problem is that when i connect to sqlplus using:
    sqlplus system/manager@mymachine
    I can only see my tables... I cannot see the tables of other users of the same database... What is the correct syntax of doing it? (Is there a good newbie doc about sqlplus?)

    Yes.
    select owner, table_name from dba_tables;
    (for example)
    OWNER TABLE_NAME
    XYZ123 MYTABLE
    desc XYZ123.MYTABLE;
    select * from xyz123.mytable;
    If you get tired of prefixing the table name with the owner, you can do the following:
    alter session set current_schema=xyz123;
    select * from mytable;

  • Query Tables Does Not Fill Down Formulas When Refreshed

    I have used external data queries for several years, connecting to a variety of data sources, but most frequently to SQL server 2005 using MS Query and ODBC. Anyway, in Excel 2007, when I refresh my queries and the data range adds new
    rows to the query table, the formluas do not fill down past the previous extent of the data range. These are not external queries converted from a previous version of Excel; I built them in Excel 2007, and the issue persists across multiple workbooks.
    To answer the inevitble suggestions:
    1) The formulas are definitely in the query tables, not adjacent.
    2) "Extend data range formats and formulas" is enabled in the advanced tab of Excel options.
    I've found threads on other sites where users had similar problems, but have not seen a satisfactory solution or even a good response to their inquiries. Any ideas?
    P. Dolan
    Stat Analyst, TN Dept of Safety

    I have the same issue with excel 2010.  To answer Ryan's last question,  Excel does seem to consider all the added rows as begin part of the table.   On the pre 2007 queries, there was an option under 'External data properties'
    to specify whether you wanted the formulas to copy down to the new rows. When this option was selected, it worked without fail.  Under 2007 and 2010 this option no longer appears, but most of the time the formulas do copy down properly, but eventually
    something happens to cause this to stop occuring.  The only fix I have found is to recreatet the whole query again.  It then works for awhile and then stops working at some point. I wish I could isolate what causes it to stop, but I haven't been
    able to figure it out.
    Same with me and Excel 2010.  The help refers to the option, but my dialog box does not have it.  (Another option that has disappeared is the ability to get column headers derived from the returned query.)
    Excerpt from help:
    On the Data tab, in the Connections group, click
    Properties.
    In the External Data Range Properties dialog box, select the
    Fill down formulas in columns adjacent to data check box.  

  • JDBC query hangs server

    I have a very weird case when a particular JDBC query kills weblogic server. Attached
    is a thread dump. What's weird is:
    1. There is only one client on the system, and I sware the client sends only one
    request. At the same time there are 12 threads trying to execute the same query.
    2. The query is at the start of thread dump and it takes ~9sec to execute on our
    DB from SQL+. It returns ~300 records. If I change parameters it will be executed
    fine. Each time a client wants to execute a query before it is executed it is
    dumped to log, and there is only one query per all threads in the dump.
    3. Looking into DB log there is no sight of the query that is dumped into log
    file. DB does not have a clue... Both DB and WLS are waiting for each other...
    Environment:
    6.1sp2 on solaris
    Oracle 8.1.7
    JDBC driver from Oracle 9i
    [x.txt]

    There were two problems: request got hanging in the database (original) with proxy
    timing out and making situation worse (sending more requests). 9.2.0.1 did not
    have the original problem (statement did not hang), but the price was too high
    (data corruption) :( Also the problem was very touchy - we got only two environments
    which were duplicating it. This last mail was more on the whining side - hope
    that someone seen something similar and can say a-ha! So I guess I'm back in slow
    and painful try to reproduce and then fix mode... Most likely it all will end
    up with SQL tuning, not app level solution...
    "Slava Imeshev" <[email protected]> wrote:
    Mike,
    AFAIR the poblem was not in the driver but in the load balancer
    resubmitting requests. Could you please try to use 9.0.1 driver.
    Regards,
    Slava Imeshev
    "mike" <[email protected]> wrote in message
    news:[email protected]...
    Unfortunately the story is not completely over.
    We found that the new driver in some cases garbles the data. That happenson updates
    when WLS is changing object and the first parameter in the updatestatement is
    string. Sounds weird, so here more details:
    - We found that some strings in the database are garbled.
    - JDBC trace brought us to update statements. It looks like for eachupdate container
    creates prepared statement and sets parameters on it.
    - If the first parameter is a string then it will be garbled (happenswith
    two
    independant objects).
    The problem is defenitely driver-specific. It does not show up withany
    driver
    but 9.2.0.1. All previous drivers work right, but 9.0.1 that we usedbefore had
    the problem described in the thread, and 8.x work at least 10 timesslower
    (no
    kidding).
    Test app which connects to the same oracle instance and executes thestatement
    from JDBC log works fine (sure it does). Adding nls_charset to classpathdoes
    not make any difference. Attempt to create statement from within WLSwas
    not taken.
    Solution was even more bizzare. Since it was happening only when thefirst
    attribute
    was string we shuffled attributes and the problem went away. But Ido not
    believe
    that is a solution - IMHO that just masks the problem.
    Any and all brignt and not-so-much ideas are welcome.

  • How to create olap cube using Named Query Table in Data source View

     I Create on OLAP Cube using Existing Tables Its Working Fine But When i Use Named Query Table with RelationShip To other Named query Table  It Not Working .So give me some deep Clarification On Olap Cube for Better Understanding
    Thanks

    Hi Pawan,
    What do you mean "It Not Working"? As Kamath said, please post the detail error message, so that we can make further analysis.
    In the Data Source View of a CUBE, we can define a named query. In a named query, you can specify an SQL expression to select rows and columns returned from one or more tables in one or more data sources. A named query is like any other table in a data source
    view (DSV) with rows and relationships, except that the named query is based on an expression.
    Reference:Define Named Queries in a Data Source View (Analysis Services)
    Regards,
    Charlie Liao
    TechNet Community Support

  • About query related problem

    hi ,
           we are generate query in 2005b,and procced for execuite query.following problem occure'<b>odbc sql server driver'[sql server] syntax error the converting the nvarchar value' 70302/20307' to column of data type int received alert OAIB</b>
    QUERY SHOWN BE AS FOLLOW.
    SELECT T5.DocNum as'Po. No. ', T5.DocDate as 'Po Date',T0.CreateDate,T5.NumAtCard as 'Man.PO. No/ Dt.', T0.DocNum as'AP No. ', T0.DocDate as 'AP Date',T0.NumAtCard as 'Vendor Ref. No.', T0.U_vbdt as 'Vendor Ref. Date', T0.CardName as 'Vendor', T1.Dscription as 'Item',  T1.Quantity AS 'QTY'  , T1.Price as 'Basic Rate', (T1.Price *T1.Quantity) as 'Value',T0.Comments as 'Po No. & Po.Dt.' FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OPDN T3 ON T2.CardCode = T3.CardCode INNER JOIN PDN1 T4 ON T3.DocEntry = T4.DocEntry INNER JOIN OPOR T5 ON T2.CardCode = T5.CardCode INNER JOIN POR1 T6 ON T5.DocEntry = T6.DocEntry INNER JOIN OITM T7 ON T1.ItemCode = T7.ItemCode INNER JOIN OITB T8 ON T7.ItmsGrpCod = T8.ItmsGrpCod WHERE (  T1.BaseRef  =  T3.DocNum )  AND ( T4.BaseRef =  T5.DocNum ) AND (  T0.U_vbdt >=[%25]AND  T0.U_vbdt <=[%26]) AND ( T4.Dscription =T1.Dscription ) AND ( T4.Dscription = T6.Dscription  ) AND  (( T1.Dscription=[%0] OR T1.Dscription=[%1] OR T1.Dscription=[%2] OR T1.Dscription=[%3] OR T1.Dscription=[%4] OR T1.Dscription=[%5] OR T1.Dscription=[%6] OR T1.Dscription=[%7] OR T1.Dscription=[%8] ) OR ( T0.CardName=[%10] OR T0.CardName=[%09] OR T0.CardName=[%27] OR T0.CardName=[%28] ) OR ((  T8.ItmsGrpNam =[%11]  oR T8.ItmsGrpNam =[%12] OR T8.ItmsGrpNam =[%13] OR T8.ItmsGrpNam =[%14] OR T8.ItmsGrpNam =[%15] OR T8.ItmsGrpNam =[%16] OR T8.ItmsGrpNam =[%17] OR T8.ItmsGrpNam =[%18] OR T8.ItmsGrpNam =[%19] ) and  ( T7.U_FirmName =[%20] OR T7.U_FirmName =[%21] OR T7.U_FirmName =[%22] 
    oR T7.U_FirmName =[%23] OR T7.U_FirmName =[%24] )) )

    Hi Vishal,
    the value '70302/20307' is not an whole number so converting it to an int is not possible.
    You should check your data for this value an change your query or data.
    Regards
    Ad

  • Running Web Layout Of JDBC Query in Oracle Report Builder 11g.

    javax.servlet.jsp.JspException: REP-4100: An attempt to execute data source failed. JDBCPDS-62008:A SQL error occurred: {0}. S1000 [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
    javax.servlet.jsp.JspException: REP-4100: An attempt to execute data source failed.
    JDBCPDS-62008:A SQL error occurred: {0}.
    S1000 [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
         at oracle.reports.jsp.ForEachTag.doStartTag(ForEachTag.java:407)
         at jsp_servlet.__module1000802592._jspService(__module1000802592.java:191)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:35)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:417)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

    For the more clarification, I have used JDBC Query as Data source type and Database connected via ODBC Driver in System DSN. The Driver selected from the drop-downs are jdbc-odbc.
    Kindly explain the mistake I m doing.

Maybe you are looking for