Solution to database query time out of minutes and seconds

Source: Internet
Author: User


The solution to the problem is that the database query time does not have time, minutes, And seconds. In a company project, the dynamic SQL method is used to query the Oracle database. When the Date type field is displayed, only the Date type field is displayed, and no time is minutes. Analysis: 1. As we all know, there are many Oralce Date types, such as Date and Timestamp. The Date type pair uses the java. SQL. Date type, and the Timestamp pair uses the java. SQL. Timestamp type. Both types are inherited from java. util. date, where java. SQL. date does not have time, minute, and second. You can check javaApi 2. the getObject (*) method of ResultSet returns java by default when the Date type is used. SQL. date www.2cto.com 3. The solution provided by many people on the Internet is to change the database Date type to the Timestamp type, and the database type DBA will not allow you to change it, in Oracle, DBAs do not have strict requirements on time and minute/second. Instead, it is recommended to use Date instead of Timestamp to save resources. 4. The Date type specified as Timestamp in ibatis's ResultMap can be displayed normally. it is found that rs is used for fields of the Date type. getTimestamp (*) can be normally displayed. solution 2. Add the Virtual Machine Parameters of the server/Java application:-Doracle. jdbc. v8Compatible = "true"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.