hello
i was wondering what the difference between the java.sql and javax.sql libraries were?
Printable View
hello
i was wondering what the difference between the java.sql and javax.sql libraries were?
They contain different stuff. The javax.sql stuff contains a few extensions to the core JDBC in java.sql, like the DataSource interface.
thanks for the reply cornedbee
is java.sql a subset of javax.sql?
No. javax.sql is an extension to java.sql. It contains additional classes and interfaces. But they still are based on the functionality provided by java.sql.
For example, javax.sql.DataSource is a method of obtaining java.sql.Connection objects.
thanks for yet another insight cornedbee
but why could they not release a new version of java.sql, why add a new library?
i guess when you import javax.sql, one does not need to import java.sql?
And why would you assume that? They're just Java packages. They have no idea that they're related.Quote:
Originally Posted by vb_student
(You shouldn't import complete packages either, just single classes selectively.)
The javax.sql stuff was originally part of the J2EE specification, which never modifies java.* packages, only javax.* packages. Thus they couldn't alter java.sql.Quote:
but why could they not release a new version of java.sql, why add a new library?
When in J2SE 1.4 they included the new stuff, they didn't want to change the package name, obviously: it would have broken both source and binary compatibility.
i thought
imported the whole package, how does one import just a class?Code:import java.sql.*
so java.* package are the foundation packages, and javax.* packages are the packages built on java.*
does java add on javax.* or does it modify javax.*
by changing/modifying the javax.* packages isn't source and binary compatibility broken?
import java.sql.Connection;Quote:
Originally Posted by vb_student
Sort of. Not all javax.* classes are built on the java.* classes; instead they provide completely independent services. javax contains Swing, for example.Quote:
so java.* package are the foundation packages, and javax.* packages are the packages built on java.*
Eh?Quote:
Does java add on javax.* or does it modify javax.*
Look, forget "modifying" and "adding". They're all just classes. They may make use of classes in other namespaces, but nothing modifies anything else.
Sure, but these packages weren't changed. Adding new classes to a package doesn't break anything (except source that uses wildcard imports like "import java.util.*" - that can break if a new symbol conflicts with another that's in scope), nor does adding new methods to classes break anything. Only modifying existing things breaks code: changing the package a class is in, for example.Quote:
by changing/modifying the javax.* packages isn't source and binary compatibility broken?
thanks for the insight cornedbee