如何获取JDBC日期格式? [英] how to get JDBC Date format?
问题描述
有没有可能从JDBC获取默认数据格式?
我编写一个程序,用户可以选择不同类型的数据库(如Oracle,MSSQL等)并插入数据。我需要JDBC来说明日期的默认格式是什么。
以前有没有人遇到过这种情况?
提前感谢您的答复。
您格式。您应该使用 PreparedStatement
并调用 setDate
或 setTimestamp
数据。应该不需要将其转换为字符串格式,因为您不应该在SQL中表示值(或任何值)。
I've looked through page, and didn't find satisfying answer.
Is there a possibility to get a default data format from JDBC?
I'am writing a program, where user can choose different type of databases (like Oracle, MSSQL etc.) and insert data to it. I need JDBC to say me what is the default format of date.
Is there anybody who has met this case before?
Thank you in advance for answers.
You shouldn't need a date format. You should use PreparedStatement
and call setDate
or setTimestamp
to pass the data. There should be no need to convert it into a string format, as you shouldn't be representing the values (or any values) within the SQL.
这篇关于如何获取JDBC日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!