JDBC / oracle / date & TIME

I am attempting to insert the date and time into a date-time field in an Orcale DB.  I am currently sending the following data into the field.
24-AUG-2007 13:45:44
and i am getting the error...
Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'VENDOR_HEADER_1000' (structure 'STATEMENTNAME1000'): java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string
Thanks
Skip Ford

Hi Skip Ford,
    Follow these links
http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetdatefromOracle.htm
http://ramblingabout.wordpress.com/2007/01/26/remember-date-time-timestamp/
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
Regards,
Santosh.

Similar Messages

  • Convert Data type from Oracle Data time string to SQL Date time data type

    I have a time stamp column pulled from oracle into a SQL server db table varchar datatype column.
    Now i want to change that column to date time.
    Following is the data present in the table:
    01-APR-11 02.15.00.026000 AM -08:00
    01-APR-11 04.15.00.399000 AM -08:00
    01-APR-11 06.15.00.039000 AM -08:00
    I want to convert this data into sql server datetime data type.
    Please advice.
    Thanks,
    Sam.
    I am unable to find the solution in other sites which is why I have posted it in Oracle forum for seeking solution.
    Thanks in Advance.
    Sam.

    Sam,
    How are you actually loading the data into SQL*Server - are you using something like an Oracle gateway, BCP or another Microsoft utility of some sort ?
    If you are using an Oracle problem then we may be able to help but if using a Microsoft utility then you should really follow up with Microsoft to know what format the data should be in to use a Microsoft utility.
    Regards,
    Mike

  • CF8. ODBC Vs JDBC Oracle Date. Time portion not returned

    Hi.
    Just upgraded one of our servers to CF8. We are connecting to
    a Oracle 10g R2 database and we have also started using Oracles
    JDBC drivers.
    If I do the following query under ODBC and dump the result.
    Query :
    Select CALL_DATE
    From CALLS
    WHERE CALL_ID=1234
    CALL_DATE
    2007-10-09 19:03:32.0
    Same query under JDBC :
    I get
    CALL_DATE
    2007-10-09 00:00:00.0
    Where's my time part gone???
    I know I can mess about with the SQL to return what I want,
    but we've got loads of old apps that use CF to format the date and
    time so it would be a bit unrealistic to do that! Plus we wouldn't
    be able to work out the time between two dates.
    HELP!
    Ta
    Nick

    I am facing a similiar issue in a different context. When I
    use select xyz_Date from abc table in coldfusion cfquery tag, the
    out put comes as follows:
    CF5 - '05-MON-2007'
    CF8 - '2008-01-27 00:00:00.0'
    Note: The xyz_Date is stored without time stamp in the
    database.
    both running on 10.2.0.3 Oracle version. This is creating
    problem when inserting dates when we only use xyz_date as a value
    to be inserted. It worked fine on CF5 but not on CF8 due to format
    change. Is there a way to set it to behave like CF5.

  • Oracle DATE/TIME COMVERSIONS

    Hi guys!
    This is my second thread about formating a date variable.
    The fact is I would like to increment a date variable in an amount of miliseconds, and after that I want to format the date to this way dd/mm/yyyy 24hh:mmi.
    An example:
    Date Variable Miliseconds to increment Date Resut
    3/13/2007 8:17:28 170000 13/03/2007 08:20
    I also want to convert an amount of miliseconds to a Time Variable (In this case date Variable) to this way 24hh:mi
    An example:
    Miliseconds Time Result
    170000 00:02
    I hope you can help me guys.
    Thanks.

    Miss read
    Milliseconds you can convert to seconds by dividing 1000
    SQL> ed
    Wrote file afiedt.buf
      1  with t as(
      2     SELECT  to_date('12/12/2007 10:00:00','dd-mm-yyyy HH24:MI:SS') LOCALDATE ,3600000 deltat
      3     FROM   dual
      4         UNION all
      5     SELECT  to_date('10/12/2007 5:00:00','dd-mm-yyyy HH24:MI:SS') LOCALDATE ,7200000 deltat
      6      FROM   dual)
      7  select localdate, deltat/(60*60*1000) hours,
      8         to_char(NUMTODSINTERVAL(deltat/1000,'SECOND')+LOCALDATE, 'dd-mm-yyyy HH:MI')
      9* from t
    SQL> /
    LOCALDATE      HOURS TO_CHAR(NUMTODSI
    12-DEC-07          1 12-12-2007 11:00
    10-DEC-07          2 10-12-2007 07:00HTH

  • Unix Seconds to Oracle Date...HELP !!!

    Hi All
    We got a Oracle (8.1.7) database and I am trying to load some data but one of the column is in Unix time format(seconds since 01-01-1970) and I am trying to convert it to Oracle Date & time (dd-mon-yyyy, hh24:mi:ss) in CST time zone.
    I am using this formula:
    select to_char(new_time(to_date('01011970', 'ddmmyyyy') + 1/24/60/60 * 1090831602, 'GMT', 'CST'), 'dd-Mon-yyyy hh24:mi:ss') "Seconds to Date" from dual;
    But it seems to me that I am getting incorrect results.
    Could someone please help.
    Cheers
    Amit

    hmmm, this is still poor support! new_time does not "know" if we are in winter or in summer.
    select new_time(sysdate, 'GMT', 'EST'), new_time(sysdate + 180, 'GMT', 'EST') from dual
    NEW_TIME(SYSDATE,'G NEW_TIME(SYSDATE+18
    04.08.2004 05:31:59 31.01.2005 05:31:59
    select
      FROM_TZ( CAST(SYSDATE AS TIMESTAMP),'GMT') at time zone 'Europe/Zurich',
      FROM_TZ( CAST(SYSDATE+180 AS TIMESTAMP),'GMT') at time zone 'Europe/Zurich'
    from dual;
    FROM_TZ(CAST(SYSDATEASTIMESTAMP),'GMT')ATT FROM_TZ(CAST(SYSDATE+180ASTIMESTAMP),'GMT'
    04-AUG-04 12.28.15.000000 PM EUROPE/ZURICH 31-JAN-05 11.28.15.000000 AM EUROPE/ZURICH

  • Insert current date and time into Oracle date type field

    I have a JDBC current date and time insert into Oracle 9i that almost works. It submits the current date and a fixed time into the Oracle date type field. I am using Tomcat 6.0.20.
    For example if I insert the data at 7:24:04 PM on Feb 16, 2010 it will insert as: 16-Feb-2010 12:00:00 AM
    The date part works but the time always shows 12:00:00 AM no matter what date or time the data is inserted.
    Here is what I have for my JDBC inserts and I also tried something with DateFormat:
    PreparedStatement ps; Date mydate = new Date(new java.util.Date().getTime()); //insert statement here.... stmt.setDate(1,mydate);
    I also tried:
    PreparedStatement ps; java.sql.Timestamp mydate = new java.sql.Timestamp(new java.util.Date().getTime()); SimpleDateFormat fmt = new SimpleDateFormat(.... //insert statement here.... ps.setTimestamp(1,fmt.format(mydate));
    Both keep submitting the date into Oracle as 16-Feb-2010 12:00:00 AM
    Anyway to get the current date and time? For example if I insert the data at 7:24.04 pm today it should show as 16-Feb-2010 07:24.04 PM in Oracle.

    sportsMarkr wrote:
    Date mydate = new Date(new java.util.Date().getTime());Please see the javadocs for java.sql.Date and note the part that says "...to zero"
    [http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
    If you want a date and time then use java.sql.Timestamp.

  • Date & time in sql through jdbc URGENT!!!

    hi,
    How do I enter date & time in this format "16 MAR 2002 12:54:23 pm" in the database of oracle through jdbc-sql?
    Please help me out.
    Its urgent.
    Regards
    Deepa Datar

    If you are familiar with Oracle, you can use PL/SQL to do the work for you. I didn't test this, but it's probably pretty close.
    String sql = "INSERT INTO TBLA
    VALUES(TO_DATE('16 MAR 2002 12:54:23 P.M.','DD MON YYYY HH24:MI:SS P.M.'))";
    I'm assuming that you know how to insert data, you are only wondering about the specifics of dates?
    This can also be done using a prepared statement. You would code the insert statement something like this:
    String sql = "INSERT INTO TBLA
    VALUES(TO_DATE(?,'DD MON YYYY HH24:MI:SS P.M.'))";
    I would suggest that if you can convert the time military (24 hour) time, it is easier to handle. The data format model for this is HH24. Otherwise you will need two prepared statements, one for A.M. and one for P.M.
    Good luck.

  • Insert date time into oracle database from jsp

    pls tell me ,from jsp how can I insert datetime values into oracle database .I am using oracle 9i .here is codethat i have tried
    html--code
    <select name="date">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="month">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="year">
    <option selected>dd</option>
    <option>2004</option>
    <option>2005</option>
    <option>2006</option>
    <option>2007</option>
    </select>
    here the jsp code
    <% date= request.getParameter("date"); %>
    <% month= request.getParameter("month"); %>
    <% year= request.getParameter("year"); %>
    try
    { Class.forName("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException exception)
    try
         Connection connection = null;
         out.println("connectiong the database");
    connection = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcsid","scott","tiger");
    out.println("connection getted");
         int rows = 0;
         String query_2 = "insert into mrdetails values(?)";
         String dob = date+month+year;
         prepstat = connection.prepareStatement(query_2);
         prepstat.setTimestamp(4,dob);
         rows = prepstat.executeUpdate();
         out.println("data updated");
    catch (Exception exception3)
    out.println("Exception raised"+exception3.toString());
    }

    To insert date values into a database, you should use java.sql.Date. If it also has a time component, then java.sql.TimeStamp.
    Your use of prepared statements is good.
    You just need to convert the parameters into a date.
    One way to do this is using java.text.SimpleDateFormat.
    int rows = 0;
    String query_2 = "insert into mrdetails values(?)";
    String dob = date+"/" + month+ "/" + year;
    SimpleDateFormat sdf = new SImpleDateFormat("dd/MM/yyyy");
    java.util.Date javaDate = sdf.parse(dob);
    java.sql.Date sqlDate = new java.sql.Date(javaDate .getTime);
    prepstat = connection.prepareStatement(query_2);
    prepstat.setTimestamp(4,sqlDate);
    rows = prepstat.executeUpdate();
    out.println("data updated");Cheers,
    evnafets

  • OIM 9.1.0.2 - Weblogic JDBC Multi Data Sources for Oracle RAC

    Does OIM OIM 9.1.0.2 BP07 support Weblogic JDBC Multi Data Sources (Services>JDBC>Multi Data Sources) for Oracle RAC instead of inserting the "Oracle RAC JDBC URL" on JDBC Data Sources for xlDS and xlXADS (Services>JDBC>Data Sources> xlDS|xlXADS > Connection Poll> URL) ?
    If yes, is there are any other modifications that need to be made on OIM, or just changing the data sources?

    Yes, it's supported. You install against one instance directly of the Rac Server. Then you update the config.xml file and the jdbc resource in your weblogic server with the full rac address. It is documented for installation against RAC. http://docs.oracle.com/cd/E14049_01/doc.9101/e14047/database.htm#insertedID2
    -Kevin

  • JDBC send data to oracle, oracle only accept column name in Upper case

    Hi experts,
    I am doing a scenario File --> XI --> JDBC,  JDBC send data to a Oracle 10g database, I have configured JDBC receiver to use XML-SQL format. in oracle database ,  table "EMPLOYEE" has a column "NAME", but when I send data to oracle using JDBC receiver, the column is "name", then XI complains
    " 'EMPLOYEE' (structure 'insert'): java.sql.SQLException: FATAL ERROR: Column 'name' does not exist in table 'EMPLOYEE'.
    can anyone help me to let oracle accpet column "name". I can't change colum in JDBC receiver from "name" to "NAME".
    Thanks a lot.

    <i>can anyone help me to let oracle accpet column "name"</i>
    Making Oracle case insensitive is not possible (in my opinion). By default all object names are stored in UPPER case in the rdbms dictionary.
    When XI searches for column name in Oracle, this search is case sensitive. So u have to configure accordingly.
    Regards,
    Prateek

  • Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER

    Hi Experts,
    What is significance of Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER.
    Thanks,
    ABDUR

    I guess this would be applicable for the folowing formats - DATE, TIME, TIMESTAMP.
    This is the correct link
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    Regards,
    Prateek

  • Is 000001010000z a valid date time in Oracle?

    Hi,
    When working with Open LDAP connection from Oracle, I need to set and remove the value '000001010000z' for locking and unlocking the user account respectively. This is working fine. However, for some calculation, I need to convert this value as a date value which I couldn't do. Is this a valid date time in Oracle? If so how to convert it as a date value.
    Oracle version: 10g R2
    Thanks,
    Natarajan

    Thanks, Mithun for your answer. We have the same issue, as an user, we can lock an account using the special value, but unable to unlock using the same user. I have reported this to our LDAP administrator.
    Regarding my question using this special value as a date value in oracle, though it is a valid date in the LDAP system, we cannot convert this as a date value in Oracle.
    Natarajan

  • Oracle Data Integrator - Real Time Integration

    Hi,
    I want to know that, is there any possibility of integrating data in real-time using Oracle Data Integrator?
    If yes, does it affect the OLTP system performance? (Could it read from db logs,etc..)
    Thanks..

    Using ODI with Logminer-based CDC will affect performance on the source system more than using Oracle Goldengate, let me explain why:
    When using the ODI Logminer-based Journalisation the Logminer functionality will move the primary-key of the affected row into the journal table. When you are then ready to move the changed data, running an interface to move the data reads the Journal-view, which joins the journal table (primary keys) to the source data (and dealing with deleted rows), optimising out duplicate rows in order to bring across the then-current state of the data, which can then be loaded into the target system, on completion, the moved rows can be removed from the journal table. The data will appear in the journal table as soon as Logminer puts it there, which may be a lag of up to two minutes using asynchronous setting, whereas Synchronous Logminer applies "system triggers to the table, with the consequent overhead.
    With Oracle Goldengate, the comitted transactions are read from the log as soon as the log-writer puts the commit into the log. All the data is picked up from the log, at that point. It is then written to the trail-file system of Oracle Goldengate which can be propogated to multiple other systems potentially with sub-second latency, and minimal impact on the source system due to the efficient reading and writing mechanisms. One other consequence of using Oracle Goldengate is that you get every change of the data, not the optimised then-current state of the data when moved.
    Hope this explanation helps.

  • Error messages when sending date-time stamp to Oracle Database

      I have a complex application that communicates with an Oracle database.  One of the table values that gets written to the table is a date-time stamp.  Until recently, the user only required a date, and this was never an error. (The format String used was %d-%b-%Y)  Now they need a time-stamp as well, so I attempted to edit the format string input of the format date/time string function to include the time. I have tried numerous format strings, each of which returns an error on execution.  Depending on which format I use, I get one of 3 different error messages.  The really odd thing is that both the date and time always get stored in Oracle without any problem (regardless of what date-time I use, as long as I include the date and any part of a time stamp - I get the entire timestamp even if I only include %I for the hour).  The only issue is that LabVIEW generates an ODBC error if I try to include the time to the date-time stamp.  In other words, teh date/time stamp writes to the Oracle database, but an ODBC error occurs every time.  I've included a word doc with screen captures of the format strings used, the resultant date/time stamps written to Oracle and the error messages generated within LabVIEW. Any advice would be most appreciated.
    Attachments:
    Summary of ODBC Error messages related to date-time stamp.doc ‏65 KB

    Oracle has a standard date format: 12-Mar-2009 that it accepts as a string, but if you want more than that, you need to use the todate() function. I used this string going into the standard LabVIEW ''Format date/time sting vi' 
    to_date('%d-%b-%Y %H:%M:%S', 'DD-MON-YYYY HH24:MIS') to create the value needed for Oracle.
    Then I use standard format string to create SQL: insert into mytable (mydate) values(%s) and select * from my table where mydate = %s using the string above for %s.
    I think you can also define a global format for all time strings but I haven't bothered figuring that out.

  • Location of oracle database crash date time

    Hi,
    After system crash happens and oracle database is recovered from system crash where can i find the entry in oracle which shows the time of system crash?
    I tried the following to get the system crash date and time:
    When i start auditing a user by logon and the user is logged on to system oracle creates an entry in dba_audit_session table for user logontime in TIMESTAMP column, but if the system crashes in between when the user is logged in to the system then no entry is made in LOGOFF_TIME column of dba_audit_session table.
    in followin example orcl user is being audited by logon.
    orcl logsin the system at time 11:36 am and my system crashes.
    when orcl logsin again after instance recovery logoff_time is blank, and shows a new entry of orcl.
    SQL > select username,to_char(timestamp,'dd-mm-yyyy hh:mi:ss'),to_char(logoff_time,'dd-mm-yyyy hh:mi:ss') from dba_audit_session where username like 'TMS' order by timestamp;
    USERNAME TO_CHAR(TIMESTAMP,' TO_CHAR(LOGOFF_TIME
    ORCL 16-10-2012 11:36:16
    ORCL 16-10-2012 11:46:33
    My aim is to get the date & time of database crash.

    Hi;
    As mention here the only way to check alert.log, If Asm avaliable you need also check asmlog and related log files.
    If you have OSwatcher on your system you can also check what process or wha happend on your server too
    PS:Please dont forget to change thread status to answered if it possible when u belive your thread has been answered, it pretend to lose time of other forums user while they are searching open question which is not answered,thanks for understanding
    Regard
    Helios

Maybe you are looking for