Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when retrieving value of a column of type DateTime (MySql server) #74

Closed
stephanievu opened this issue Sep 19, 2019 · 0 comments

Comments

@stephanievu
Copy link
Contributor

What I Did
I have a table in MySql database server with DateTime type, column 'time_val'
Aftter inserting "2019-09-19 13:59:48" to time_val column, I'm unable to retrieve it. I got error
ResultSet rs = st.executeQuery("select id, int_val, str_val, date_val, time_val, TIMESTAMP_VAL from jdbc_occ_test where id=" + _id);
rs.next();
System.out.println ("Time: " + rs.getTimestamp(5));

What I Expected
I should be able to get date/time successfully

What I See
com.paypal.infra.occ.ex.OccSQLException: Failed to parse Timestamp
at com.paypal.infra.occ.jdbc.OccResultSet.getTimestamp(OccResultSet.java:445)
at com.paypal.infra.qa.java2occ.PrepareExecuteTest.test_DateTime(PrepareExecuteTest.java:1185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.text.ParseException: Unparseable date: "2019-09-19 13:59:48"
at java.text.DateFormat.parse(DateFormat.java:366)
at com.paypal.infra.occ.util.OccJdbcConverter.occ2timestamp(OccJdbcConverter.java:99)
at com.paypal.infra.occ.jdbc.OccResultSet.getTimestamp(OccResultSet.java:443)
... 20 more

@voicup voicup closed this as completed in cc26999 Sep 20, 2019
rasamala83 added a commit to rasamala83/hera that referenced this issue Jul 18, 2024
Co-authored-by: Rajesh S <samal.rajesh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant