JDBC and ADO. net

Source: Internet
Author: User

I first learned about. net. after about three years of use, I switched to Java development.Program. When I first started using JDBC, I thought its interface was strange. The strange points are as follows:
1. preparedstatement is derived from statement, but some public methods in statement, such as execute (string SQL), cannot be called by preparedstatement instances.
2. The parameter count starts from 1, rather than 0. This is a mine. It is waiting for you to step on. People who use it initially usually step on the mine. I think the JDBC designer will laugh at this moment, haha! Another Sb recruited ......
3. The setstring () method of preparedstatement does not distinguish nchar from Char, which makes some database drivers unable to support nchar and nvarchar data. For example, the JDBC driver of Oracle 8i explicitly states that the nchar and nvachar2 types are not supported. In the driver of Oracle 9i, there is a proprietary Implementation of setformofuse (...), this problem can be solved. However, you cannot program based on the JDBC interface or change the JDBC driver.

The designer of the JDBC interface must be an expert !!

Ado. Net comes with a series of classes that support disconnected to access data, including dataset and datatable. This makes data access simple and its interfaces are easy to use. Ado. Net has the advantages of simple use of Microsoft products, and it is a bit cool as Microsoft products. One of them is that although sqlclient, oracleclient, oledb, ODBC, and other dbproviders all inherit the same interface, this does not allow you to program based on the interface in ADO. net. One of the reasons is that the parameter styles of different dbprovider SQL statements are different. SQL Server uses @ parametername-style named parameters, Oracle uses the parametername style, and oledb and ODBC both use anonymous parameters. It's a big mess !!!

In ADO. net, changing the dbprovider is not as easy as JDBC. It can be said that the openness of ADO. NET is worse than that of JDBC. Ado. NET 2.0 seems to have implemented some enhancement measures in this regard. But it is not as good as JDBC!

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.