jdbc - basic doubt
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: jdbc - basic doubt

  1. #1
    Join Date
    Sep 2002
    I use jdbc to use Oracle database.

    Does using jdbc means by changing the driver I can use
    any database? irrespective of whether that database system
    has the same sql syntax or not? Should i change my sql
    statements that I use in java, to suit the syntax of the
    db system? Or the same syntax should work - ie., the driver
    will take care and convert to the required syntax?

    thanks, f

  2. #2
    Join Date
    Dec 2001

    if you use standard jdbc defined by Sun your code is going to be portable, no matter what database you will be using - your database needs to be relational, of course, then your sql will be portable too.
    For each database, you must have a driver. For example, to use jdbc with oracle with must have oracle jdbc drivers (classes12.zip). You also can use oracle extention for jdbc, then your code will need to change if you change database.


  3. #3
    Join Date
    Sep 2002
    Is the code portable even if the underlying database's
    sql syntax is different? ie., will the jdbc driver convert
    the sql into its propreitary syntax?

    Particularly I am concerned about the SEQUENCE syntax.


    doesnt this assume the presence of a table called "DUAL"
    in the database? is this oracle specific or not?

  4. #4
    Join Date
    Mar 2002
    No, your code will not be portable. You will not get an error on the Java level but, as you already expect it, on the database level when you ll try to run you statement on the DB.

  5. #5
    Join Date
    Dec 2001
    JDBC is a standard API for connecting to databases. This means that you can connect to any database and process SQL statements using the same programatic logic. However, it does not mean that any SQL statement will work with each engine. It is up to you to make sure you have either SQL that will work with all engines, or you have an application that can be customised for all eninges.

    OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
    OCA PL/SQL Developer
    Oracle ACE Director
    My website: oracle-base.com
    My blog: oracle-base.com/blog

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