Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between javax.sql and java.sql?

Tags:

java

sql

jdbc

What is the difference between javax.sql and java.sql I understand that javax.sql is for JavaEE. or am I wrong.

I am struggling with understanding this difference. And their usage scenarios.

like image 931
Sunny Patel Avatar asked Aug 13 '13 15:08

Sunny Patel


People also ask

What is javax SQL in Java?

The javax. sql package provides for the following: The DataSource interface as an alternative to the DriverManager for establishing a connection with a data source. Connection pooling and Statement pooling. Distributed transactions.

Which SQL is used for Java?

What you will probably be doing is using JDBC to allow Java to connect to SQL databases. There are also persistence layers, such as Hibernate, that you can use to store and retrieve data in a database using Java.

Does JDBC API has two packages as Java SQL and javax SQL?

The JDBC API is comprised of two packages: java. sql. javax.

What is Java SQL connection?

A connection (session) with a specific database. SQL statements are executed and results are returned within the context of a connection. A Connection object's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on.


2 Answers

What is the difference between javax.sql and java.sql I understand that javax.sql is for JavaEE.

It used to be that javax.sql was for JDBC extensions that were in Java EE and not Java SE, but this changed as of JDBC 3.

Now both packages are part of JDBC in Java SE, and the fact that there are two packages is now just a historical anomaly. The two packages continue to exist because removing one would cause backwards compatibility problems.

like image 53
Stephen C Avatar answered Oct 05 '22 23:10

Stephen C


Java.sql

Provides the API for accessing and processing data stored in a data source (usually a relational database) using the JavaTM programming language.

. This API includes a framework whereby different drivers can be installed dynamically to access different data sources. Although the JDBCTM API is mainly geared to passing SQL statements to a database, it provides for reading and writing data from any data source with a tabular format. The reader/writer facility, available through the javax.sql.RowSet group of interfaces, can be customized to use and update data from a spread sheet, flat file, or any other tabular data source.

Javax.sql

Provides the API for server side data source access and processing from the JavaTM programming language. This package supplements the java.sql package and, as of the version 1.4 release, is included in the Java Platform, Standard Edition (Java SETM). It remains an essential part of the Java Platform, Enterprise Edition (Java EETM).

like image 25
Suresh Atta Avatar answered Oct 06 '22 01:10

Suresh Atta