如何获取JDBC日期格式? [英] how to get JDBC Date format?

查看:104
本文介绍了如何获取JDBC日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有可能从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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆