Java sql and Oracle resultsets

I am trying to execute a query but I never get anything back from the database.
Do I have to format the date in my sql quoted string to get it to bring back data correctly?
The sql that I am trying to execute looks like the following.
sql = "SELECT " + REPORTTRANSDATE + ", " + REPORTCUSTACCTNUM + ", " + REPORTNAME + ", " + REPORTAMOUNT + ", " + REPORTTENDER + ", " + REPORTTRACKINGID + ", " + REPORTRETURNCODE + " FROM " + REPORTTABLE + " WHERE " + REPORTBILLERID + "=?" + " AND " + REPORTTRANSDATE + ">= ?" + " AND " + REPORTTRANSDATE + "<= ?" + " ORDER BY " + REPORTTRANSDATE;
Prior to executing the query the following date parameters are provided.
I am using a preparedstatement.
stmt.setDate(2, new java.sql.Date(sqlFromDate.getTime()));
stmt.setDate(3, new java.sql.Date(sqlToDate.getTime()));
The from date looks like this: "07/11/2004 00:00:00"
The to date looks like this: "07/11/2004 23:59:59"
The dates are in java.util.Date format to start with and I am trying to get them into java.sql.Date to pass in the values. Is the above date format ok or does it need to look like "11-Jul-2004 00:00:00" for Oracle?
Thanks for you help.

Is there anyway to get the resultset to display the
actual query being run when using ExecuteQuery?
I am talking about the sql string after the parameters
have been supplied using the stmt.setTimestamp...
I would like to be able to see exactly what the
database is seeing when the query is executed.As far as I know, there is not. However, if you are using oracle, then you can get the exact SQL that is getting executed. I am not sure as to the details (the word sqltrace comes to mind, but I don't know if that is a colloqialism or an actual term). Your friendly Oracle DBA can probably help out more here than I can.
- N

Similar Messages

  • b font color ='red' Java JDBC and Oracle DB URGENT HELP PLEASE /font /b

    Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explain
    import java.sql.*;
    import java.sql.DriverManager;
    import java.sql.Connection;
    public class SqlConnection {
         public static void main(String[] args) {
              Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
              Connection con = DriverManager.getConnection
              ("jdbc:orcle:thin:@34.218.5.3:1521:ruka","data","data"); //making the connection.
              Statement stmt = con.createStatement ();// Sending a query to the database
              ResultSet rs = stmt.executeQuery("SELECT man,jean,test,kok FROM sa_kostl");
              while (rs.next()) {
                   String man = rs.getString("1");
                   String jean = rs.getString("2");
                   String test = rs.getString("3");
                   String kok = rs.getString("4");
                   System.out.println( man, jean, test,kok );//here where my the
                                                 //compiler gives me errors
              stmt.close();
              con.close();
    }

    <b><font color ='red'>Java JDBC and Oracle DB URGENT HELP PLEASE</font></b>Too bad your attempt at getting your subject to have greater attention failed :p

  • Java.sql.SQLException:Exhausted Resultset

    Hi,
    I am Getting java.sql.SQLException:Exhausted Resultset after filling up the form and clicking submit button so that values inserted in to Database but instead of insertion iam getting this error.
    ThankQ
    Regards
    Saikishore

    You are trying to call a closed resultset.
    check your code. if u don't find then post your relavant code
    (Dhananjay Singh)

  • Java.sql.SQLException: No ResultSet was produced

    HCAF_PLCaddEngName = EngiNameTextField.getText();
                 Connection connection = null;
                 Statement statement = null;
                 try
                     // Load the JDBC driver
                     // Create a statement
                     statement = connection.createStatement();
                     // Execute a statement
                    resultSet = statement.executeQuery("INSERT INTO Table_name (Emp_name) VALUES ('"+ HCAF_PLCaddEngName+"' )");
                     Move = resultSet.next();why is it that i keep getting this erros:
    java.sql.SQLException: No ResultSet was produced
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:259)
    at RevisionIn$addButton.actionPerformed(RevisionIn.java:176)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:5517)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5282)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3984)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1791)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 8 seconds)

    what cmd should i used in this caseYou never stated your requirements.
    Let's start over. Forget the code you posted and tell
    us: what are
    your requirements? What is your goal?I'm trying to pass the value of EngiNameTextField to the table_name table
    HCAF_PLCaddEngName = EngiNameTextField.getText();
    this is the line of code, but i guess i have to used executeupdate
    to insert values in to a table
    resultSet = statement.executeQuery("INSERT INTO Table_name (Emp_name) VALUES ('"+ HCAF_PLCaddEngName+"' )");
                     Move = resultSet.next();

  • Problem with Java 5 and Oracle 10g JDBC driver

    Hi All,
    Currently we upgrade our web application to Java 5 and Oracle 10.2 JDBC driver. And we encountered a bug, when the user entered the information through UI and data didn't store into database (Oracle 9i). The problem is that this bug is not happend so often maybe once a day and this did not happen before we upgraded to Java 5 and Oracle 10.2 JDBC driver. Does anyone encounter the same problem ? Is this Java 5 problem or Oracle JDBC driver problem ?
    Thanks,

    sounds like a database problem...
    Are you using a driver version that's supported for your database engine?
    What else did you change? We once ran into a major bug in our application that had for 5 years been masked by performance problems in our hardware and infrastructure.
    Once those were resolved the bug showed itself and caused tens of thousands of records to be erroneously inserted into our database every day.
    It's certainly NOT a problem with your JVM (if it's a decent one, like the Sun implementation).
    So it's either your database, your driver, your network (dropping packets???), or your application.
    The upgrade may just have exposed something that was already there.

  • Can We use FDM as ETL tool between SQL and Oracle

    I want to use FDM as ETL tool between SQL and Oracle. Can it be possible. I didn,t found any target adapter for oracle database.My source system is SQL and Target system is Oracle database.
    Rahul
    Edited by: user12190125 on Nov 9, 2009 4:23 AM

    Rahul,
    I believe this is possible to do, but not an easy one and there are a few considerations:
    How much data are you processing? FDM has a lot of features which support the business process. While this is great for users and audit trail etc. it slows down performance if you want to process a lot of data. It also depends on the type of mappings you use (Like mappings are slower than explicit mappings).
    How familiar are you with VBScript? There is no explicit target adapter for Oracle, but there is a data mart adapter which can be used for anything. You have to implement everything yourself though, mainly the Export and Load actions. In there you will also have to handle the the connections to the MSSQL and Oracle databases.
    Check the data mart adapter and see if you feel comfortable with defining the vb code in there. There are reasons for and against this approach. ODI would probably be the better choice unless you really need to have FDM's process support.
    Regards,
    Matt

  • Guide to differences between SQL Server Transact SQL and Oracle PL/SQL

    Does anyone know of a good book (or online guide) that has an in-depth comparison of the differences between SQL Server Transact SQL and Oracle PL/SQL? (Something more than a beginner's guide)

    Hello,
    Below links will surely be helpful
    Discontinued features in SQL 2012
    Depricated features in SQL Server 2012
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • SQL and Oracle in synchronization

    I have to synchronize for about 2 months one Oracle 9.i database and one SQL server 2000, Standard edition database, both running on Win 2K Server. Every change made on either of the databases (the best is there are only 4-5 tables reflected) has to be provided on the other side almost in real time. I choused to use SQL server as a way to do it. For Oracle I have only the ODBC connectivity (supplied for free) and I did have a lot of problems in ORA 8.1.6... Needless to say, there's no money for third party products or even new ORA transfer utility, as the 2-month are not sufficient time.
    I did set up linked servers between SQL server and Oracle and trying to make some triggers working for me, but is this the best way to do it? May be somebody has better experience...
    Any ideas will be greatly appreciated.
    Thanks,
    MJ

    Do you really like to implement a two way replication between M$ SQL and Oracle?
    Maybe you can try this using the heterogenous gateway and Oracle Advanced replication. Don't know if this could work our test environment would be ready but actually there's no time to try.
    Will keep you informed if I know more.
    In this way you don't need any third party sw and I think it could work, but never have tried it out.
    Could be an interesing challenge ;-)
    Michel

  • What is Difference between ANSI SQL and ORACLE SQL

    Hi,
    I am going to take the assesment test for ANSI SQL Programming before that i want to know any difference between ANSI SQL and ORACLE SQL?
    I am studying for SQL but the test will be ANSI SQL please let me give an idea about the both.
    Thanks
    Merina Roslin

    Basically there is syntax difference between both of them.
    Lets say i want to join two table EMP and DEPT based on DEPTNO.
    With Oracle SQL format its like this.
    select e.*
      from emp e, dept d
    where e.deptno = d.deptnoHere the joining condition goes in the WHERE clause.
    With ANSI SQL format its like this.
    select e.*
      from emp e
      join dept d
        on e.deptno = d.deptnoHere the join condition is mentioned separately and not in WHERE clause.
    Oracle supports ANSI SQL starting from 9i version.
    You can read more about the syntax difference Here

  • Uses for the Action Property with SQL and Oracle DB Adapters

    This thread is a complement to the Wiki Article
    BizTalk: Streamlining WCF SQL and Oracle Messaging-Only and Other Patterns
    The question.  In what circumstances is explicitly setting the Action value with the WCF SQL and Oracle DB bindings useful or beneficial. 
    A complimentary question.  Is it even possible to set the Action value to anything other than exactly what is required by the Message.
    I ask because of three very specific behaviors of the bindings themselves:
    The binding enforces a match between the Action and the Message, therefore...
    There is a one-to-one relationship between the Message and Action, but...
    The binding is able to correctly derive and perform the requested operation with the unspecific CompositeOperation.
    For clarity, I understand how to set the Action. I. understand what the Action represents in the SOAP scheme. I understand how Action can be used as an abstraction for SOAP operations.
    Thoughts?

    Do you have any good suggestion to learn how to use action property with SQL and Oracle DB adapters?  I learn a lot from your replies for years in BizTalk forum. :)

  • About SQL and Oracle

    Hello, I was using a MySQL database and i will soon use Oracle8. I was wandering if Oracle authorize something like mysql_result... I'm looking too for simple documentation about connecting to an Oracle database from a php file using Sql. Do u know books or sites ? Tks

    user12317666 wrote:
    Does Oracle support T-SQL ? Why would Oracle support a proprietary macro-based language implementation from a competitor?
    If it is not supported in Oracle, what is the major grammer difference between T-SQL and Oracle supported SQL ? Oracle has two languages. SQL. PL/SQL.
    PL/SQL is formal declarative procedural language with object orientation programming features. It is based on the Ada language (close relative of the Pascal language).
    SQL is fully integrated with PL/SQL. Which means that you can write and mix SQL source code with PL/SQL source code and the PL/SQL compiler will figure out which is which and where to make calls to the SQL engine for executing SQL code.
    Is there any efficient way for programmer to complete T-SQL transition to Oracle SQL ? Yes. Unfortunately not the answer that you are likely hoping for.
    Forget EVERYTHING you did with T-SQL.
    There is no real comparison between the two. And not only many differences, but some fundamental and conceptual differences too.

  • Need a function name for Sql and Oracle

    Retrieving value of next line by doing opteration in previous row.

    Can you rephrase the question? Or better yet, provide an example? I'm not sure I understand what you are asking.
    My best guess is that you are looking for the analytic functions LEAD or LAG in Oracle, assuming you are on a relatively recent Oracle version. If by "SQL and Oracle" in your subject you mean "SQL Server and Oracle" (SQL is a language that all relational databases implement, SQL Server is Microsoft's relational database), I have no idea how (or if) you can do something similar with a built-in function in SQL Server. You would want to post in a SQL Server group to see how they handle that sort of thing.
    Justin

  • Tablespace size report for SQL and oracle servers

     
       Hi All
      is it possible to get tablespace size for all sql and oracle server in the form of report in SCOM.
      Regards
      Madhavi

    Oracle: Table size report of Oracle is depend on the MP which yu imported into SCOM
    SQL :
    1) Create a group which contains folowing dynamic rule
    2) Reporting workspace --> Microsoft Gneric Report --> Performace Detail
    3) in the parameter area, create a new series, add group which create in step 1) and select the rule: MSSQL XXX: Collect Database Allocated Size(MB)
    4) Run the report
    5) In the report, click actions and select "Performance details for every object"
    Roger

  • Frequently transfering databases between MS SQL and Oracle

    Hello all,
    I am looking for a solution to easily, efficiently and be able to migrate/transfer databases between MS SQL and Oracle frequently.
    I need to be able to replicate a databases on Ms SQL and Oracle for testing purposes. I will need to do this on frequent basis - almost once a week.
    Please suggest what would be the best way.
    Thanks in advance.

    Hi Justin,
    You have guessed it right to a great extend. Yes dont actually need to develop, rather need to test an application that supports SQL and Oracle databases. Now when testing the application its obviously vital to create proper systematic test data. This usually takes a lot of time and effort from the testing team/team-member. So, yes what I need to do is create the test data on one database(may it be SQL or Oracle) and migrate/transfer the data into the database on another server( ie. SQL to Oracle or Oracle to SQL).
    So,
    Are you developing a product that works against both SQL Server and Oracle and trying to synchonize development efforts?Yes, thats correct to extend, I need to test an application against both the servers, as it supports both types of databases, and try to reduce the test setup efforts (literally double the amount) that go in after manual creating same data on each type of database.
    Are you trying to replicate structural changes between systems?I am not 100% sure, what you mean by this. But whats important and enough for me is to replicate the data. It would not be a lot of work to run the scripts and create empty schema objects.
    Are you trying to replicate data changes between systems? The fact that you're only doing this weekly suggests that you're not working in a traditional replication environment.Yes, again as I mentioned above. It would be sufficient for me to just get a copy of the initial dataset. And then replicating changes to it would not be that important. However, if I can achieve a solution to this, I can by all means create a new database on the one server (SQL or Oracle) and take the data-set of the most recent/correct changes and replicate it on the other type of server as and when needed.
    No - this is not a traditional replicating environment. I say weekly, because it is usually once in a week or forthnight that someone from the team will need to spent time to manually copy the test-data onto the another type of server in order to run the same testcases on two types of servers.
    How do you handle conflicts (i.e. if I modify a row in both systems, which modification wins)? This is not really a problem in my scenario, as I only need to be able to transfer the data across to the different server and forget about the two databases actually being in-sync.
    I have also, looked at DTS for a possible solution on SQL, however it seems highly un-realistic, having to map somewhere like 250 tables from the a drop-down list, only because the two database servers use different cases to represent tables internals. So, table 'Table' in my application's SQL database is called 'TABLE' is my applications Oracle database. DTS is highly inefficient in dealing with this. Also, having 250 tables move makes this a bit of a pain.
    Thank you Justin for your response; I highly appreciate your inputs.
    Regards, Nisarg

  • Dblink creation between sql and oracle server

    Hi dears,
    I need to create dblink between the sql and oracle server.
    (For me the requirement is sql datas need to import in oracle database).
    My questions is,
    Without installting gateway is't possibale to get the sql data in the oracle server.
    my database version is 11.2.0.3 64bit
    Kindly let me know, Waiting for your suggestsion.
    Regards
    Athish

    About the Linked Server mechanism have a look at the MS Knowledge base article:
    Article ID: 280106 - HOW TO: Set Up and Troubleshoot a Linked Server to Oracle in SQL Server
    or
    How to run a SQL Server 2005 Integration Services package as a SQL Server Agent job step Article ID : 912911
    Regarding DG4ODBC and DG4MSQL, please have a look at our Support portal and look for the gateway master note:
    Master Note for Oracle Gateway Products          [Document 1083703.1]     
    It contains generic information how to connect to the foreign database
    Document 233876.1 Options for Connecting to Foreign Data Stores and Non-Oracle Databases - For example - DB2, SQL*Server, Sybase, Informix, Teradata, MySQL
    as well as the functional differences between the Database Gateway for ODBC (Generic Connectivity) and MS SQL Server
    Document 252364.1 Functional Differences Between Generic Connectivity and Database Gateways
    Document 232482.1 Gateway and Generic Connectivity Licensing Considerations
    as well as where to find the latest release and how to install and configure them.

Maybe you are looking for