Results 1 to 9 of 9

Thread: [RESOLVED] difference between java.sql and javax.sql

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Resolved [RESOLVED] difference between java.sql and javax.sql

    hello

    i was wondering what the difference between the java.sql and javax.sql libraries were?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: difference between java.sql and javax.sql

    They contain different stuff. The javax.sql stuff contains a few extensions to the core JDBC in java.sql, like the DataSource interface.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: difference between java.sql and javax.sql

    thanks for the reply cornedbee

    is java.sql a subset of javax.sql?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: difference between java.sql and 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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: difference between java.sql and javax.sql

    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?

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: difference between java.sql and javax.sql

    Quote Originally Posted by vb_student
    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.
    (You shouldn't import complete packages either, just single classes selectively.)

    but why could they not release a new version of java.sql, why add a new library?
    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.
    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: difference between java.sql and javax.sql

    i thought
    Code:
    import java.sql.*
    imported the whole package, how does one import just a class?

    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?

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: difference between java.sql and javax.sql

    Quote Originally Posted by vb_student
    imported the whole package, how does one import just a class?
    import java.sql.Connection;

    so java.* package are the foundation packages, and javax.* packages are the packages built on java.*
    Sort of. Not all javax.* classes are built on the java.* classes; instead they provide completely independent services. javax contains Swing, for example.

    Does java add on javax.* or does it modify javax.*
    Eh?
    Look, forget "modifying" and "adding". They're all just classes. They may make use of classes in other namespaces, but nothing modifies anything else.

    by changing/modifying the javax.* packages isn't source and binary compatibility broken?
    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: difference between java.sql and javax.sql

    thanks for the insight cornedbee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width