Why jdbc api ?why not use odbc api from java application?

hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubt

chari wrote:
hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubtbecause jdbc is the way that java does it.
use it or don't.
C++ was in the market before java - why was java developed at all? cobol was in the market before C++ - why was C++ developed at all?
%

Similar Messages

  • Using Unix commands from Java Application

    Hi,
    I need to write an Java application such that could run Unix commands in a Unix box.
    For example, my Java app needs to log in the Unix box, change directory (cd), create new folder (mkdir), list the current files in folder (ls), mount a new device (mount), etc.
    Thank you very much.
    Hung

    you can use java.lang.Runtime.exec to invoke OS commands, but if you're going to be completing a sequence that complicated and need to manage error handleing well, it might be best to just invoke a native method or write a shell script that does all of that stuff and then invoke that script via Runtime.exec . The Runtime class has limitations when you start invoking processes that require user input (like 'su'). Search the forums for more extensive examples on how to use Runtime.

  • Gif file not found in JAR from Java Application

    Hello Forumers,
    Could some one please explain how to create a JAR file from where I can get a GIF file. I have tried a number of different ways but it allways fails. (I have tried to add the GIF files using the jar command and I have tried to add it using WinZip after the jar is created).
    To isolate the problem I created this very simple program, the program works very well when the gif file resides on the directory from where I run the Application, but when I remove it from the directory it fails. I have tried to put the GIF file in the JAR in a number of different ways but it allways fails. (I have also tried with and without slash before the name of the GIF). I guess the problem is the way I create the JAR file
    import java.io.*;
    public class GifTest
    { public static void main(String args[])
    { InputStream in = GifTest.class.getResourceAsStream("/open.gif");
    if (in==null)
    System.out.println("Null returned");
    else
    System.out.println("OK");
    Any Hints appreciated
    /Kjell

    Hi,
    here is a small application using my own class GetImageIcon.
    Normally I have this "help-class" in a utility-package to use it from all my projects without copying. For this example I copied the code in the test application. Feel free to use the code of the class like you want. For me it works fine.
    Do the following:
    1. Create a folder called /meta-inf under the folder where the class-files are. Use a text-editor and create a file saved as "manifest.mf".
    manifest.mf tells the jar-file which is the main-class from where the application will start when double-clicked.
    It only has to contain one line:
    Main-Class: GifTest
    2. Compile and create the jar file. I made a bat-file containing:
    javac -verbose GifTest.java
    %pause
    REM Create Jar-File
    jar cmf meta-inf/manifest.mf GifTest.jar *.class *.gif
    REM Show Table of Content of the Jar-File
    jar tf GifTest.jar
    %pause
    So you can see what's in the jar-file.
    3. When you double-click on the jar-file the application is executed. So it is easier to use for the users. They don't have to type in anything on the command-line. You can deploy this jar-file to any client and run it. The only thing you have to do, is to install the JRE on the clients.
    I develop with JDK 1.3.1 and JRE 1.3.1 is installed on the clients of the company I work for.
    //Begin of the code
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.jar.*;
    public class GifTest extends JFrame
            protected JLabel m_title;
            protected ImageIcon m_image;
            static File file;
            //You have to define the name of the jar-file
            static String jarFile = "GifTest.jar";
            //Instance of the class GetImageIcon
            protected GetImageIcon gii = new GetImageIcon();
            public GifTest()
                    super("GifTest");
                    setSize(400,200);
                    //the name of the image and the name of the jar-file the image resides in
                    m_image = gii.getImageIcon("orb.gif", "GifTest.jar");
                    m_title = new JLabel(null, m_image, SwingConstants.CENTER);
                    getContentPane().add(m_title, BorderLayout.NORTH);
            public static void main(String argv[]) {
                    GifTest frame = new GifTest();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setVisible(true);
    public class GetImageIcon{
    * @param fileName the full qualified name of the file
    * from the root of your application. use a "/" before the
    * fileName, eg. /images/warning.gif
        public ImageIcon getImageIcon(String fileName, String jarName) {
            int counter, c, i = 0;
            byte buffer[];
            JarFile  jfile;
            JarEntry jentry;
            InputStream in;
            ImageIcon m_image;
            try{
                    // Create Jar-File object from JarFile
                    jfile = new JarFile(jarName);
            catch(Exception ex){
                    System.out.println("JarFile-Problem " + "\n" + ex);
                    return null;
            try{
                    // create Jar-Entry object from File-Name in JarFile
                    jentry = jfile.getJarEntry(fileName);
            catch(Exception ex){
                    System.out.println("JarEntry-Problem " + "\n" + ex);
                    return null;
            try{
                    // create InputStream from JarEntry
                    in = jfile.getInputStream(jentry);
            catch(Exception ex){
                    System.out.println("JarEntry-Problem " + "\n" + ex);
                    return null;
            try{
                    //get uncompressed size of entry data in Jar-File and create byte-array with this size
                    buffer = new byte[(int)jentry.getSize()];
                    //write int-value 'c' (casted to byte) with read() and while-loop in byte-Array
                    while((c = in.read()) != -1){
                            buffer[i] = (byte)c;
                            i++;
            catch(Exception ex){
                    System.out.println("in.read()-Problem " + "\n" + ex);
                    return null;
            try{
                    //create ImageIcon with byte-Array 'buffer'
                    m_image = new ImageIcon(buffer);
            catch(Exception ex){
                    System.out.println("ImageIcon-Problem " + "\n" + ex);
                    return null;
            // return the created ImageIcon
            return m_image;
    }

  • Why not use notifyall

    now I'm reading this book "Java Threads 2nd edition" by Scott Oaks and Henry Wong. Writer provide a class called BusyFlag to simulate the mutex.
    I wonder why not use notifyall() to replay notify().
    public class BusyFlag {
         protected Thread busyflag = null;
         protected int busycount = 0;
         public synchronized void getBusyFlag() {
              while (tryGetBusyFlag() == false) {
                   try {
                        wait();
                   } catch (Exception e) {
         public synchronized boolean tryGetBusyFlag() {
              if (busyflag == null) {
                   busyflag = Thread.currentThread();
                   busycount = 1;
                   return true;
              if (busyflag == Thread.currentThread()) {
                   busycount++;
                   return true;
              return false;
         public synchronized void freeBusyFlag() {
              if (getBusyFlagOwner() == Thread.currentThread()) {
                   busycount--;
                   if (busycount == 0) {
                        busyflag = null;
                        *notify();*
         public synchronized Thread getBusyFlagOwner() {
              return busyflag;
    }

    naficbm wrote:
    now I'm reading this book "Java Threads 2nd edition" by Scott Oaks and Henry Wong. Writer provide a class called BusyFlag to simulate the mutex.
    I wonder why not use notifyall() to replay notify().Looks like it should work with notifyall as well.

  • Why not use "new" operator  with strings

    why we not use new when declaring a String .because in java String are treated as objects. we use new operator for creating an object in java .
    and same problem wiht array when we declare array as well as initialize .here we are alse not using new for array
    why

    Strings aren't just treated as objects, Strings are Objects.
    As for why not using new for Strings, you can, if you want.:
    String str = "this is a string";
    and
    String str = new String("this is a string");
    do the same thing (nitty-gritty low level details about literals aside). Use whatever you like, but isn't it simpler not to type new String(...) since you still need to type the actual string?
    As for arrays, you can use new:
    int[] ints = new int[10];
    or
    int[] ints = { 0, 1, 2, 3, ..., 9 };
    But the difference here is you are creating an empty array in the first one, the second creates and fills the array with the specified values. But which to you often depends on what you are doing.

  • Why not use paper label on finished DVD project?

    I also use printed paper labels for my DVD covers
    why not use them?
    please advise?

    Hi
    The DVD get's unbalanced = Laser can't read track
    DVD are several times more sencitive than CD (not advicable to put lables on them either)
    And DVDs/CDs that are unbalanced also give more strain to the player mechanism
    that eventually stops working.
    Yours Bengt W

  • Why not use interfaces for constants?

    Hi,
    I have been getting conflicting views about why not use interfaces for constants?
    Can anyone shed some light on it?
    Piyush

    How so?
    If the constants are only used in a single classhow
    does it help to put them in a separate structute?
    (Ignoring the a type safe enumeration of course.)Well, mainly for readability. Suppose that you have a
    web application which has a servlet class
    "RedirectServlet", which takes a variable to redirect
    to a given JSP file. In the JSP files, you want to
    create forms which take this servlet as their action.
    You could of course put all these "redirect"
    constants in the RedirectServlet itself, but then
    it's kind of weird that you have to import a
    servlet in your jsp file to include these constants
    and to be able to write
    <form action="servlet/RedirectServlet?key=<%=
    RedirectServlet.HOMEPAGE %>> or so.
    Instead, you could create an interface called
    "RedirectConstants", and then your servlet
    RedirectServlet could implement this interface. Then
    your JSP can also access these constants via this
    interface.
    But then again, this is merely a matter of style, I
    fully agree that there is never a real _need_ to put
    constants in a separate structure if they're only used
    in a single class.Are you claiming that your example above is a single class?

  • Why can i not use  my giftcard from aruba

    why can i not use my giftcard from aruba to buy in the itunes store

    that not tru i buy a lot of things with my giftard from aruba on other websides in the usa and it was no problem.
    why with the apple itunes store is it a problem i have my usa adressin miami, now i understands why they say that a galaxy is better than apple.
    there is now problems with this things

  • I know that iCloud backs-up apps and other stuff to your phone incase you want restore from a back-up if you start a New iPhone. My question is if I start a new iPhone (not use the restore from back-up option) and redownload apps like (games, Instagram),

    I know that iCloud backs-up apps and other stuff to your phone incase you want restore from a back-up if you start a New iPhone. My question is if I start a new iPhone (not use the restore from back-up option) and redownload apps like (Games, Instagram), would my pics show up on Instagram and would my Games show it was saved and the acccomplisments will remain from the last place I left out.

    Davin12 wrote:
    I know that iCloud backs-up apps and other stuff to your phone incase you want restore from a back-up if you start a New iPhone. My question is if I start a new iPhone (not use the restore from back-up option) and redownload apps like (Games, Instagram), would my pics show up on Instagram and would my Games show it was saved and the acccomplisments will remain from the last place I left out.
    Icloud or itunes backup, only backs up app data, not the app itself.
    so if you restore as new, then there is no app data on your phone, you start out new...

  • I am making my first keynote presentation.  I transferred the slides from a power point.  I did not use a 'theme' from keynote.  Keynote will not let me 'name' the presentation and the 'save as' option will not come up in the menu.  What have I done wrong

    I am making my first keynote presentation.  I transferred the slides from a power point.  I did not use a 'theme' from keynote.  Keynote will not let me 'name' the presentation and the 'save as' option will not come up in the menu.  What have I done wrong

    When it comes to Keynote, I try and start with a presentation that's 1680 x 1050 preset or something in that range.  Most projectors that you'll get at a conference won't project much higher than that and if they run at a lower resolution, it's better to have the device downsize your Keynote.  Anything is better than having the projector try and upsize your presentation... you work hard to make it look good, and it's mangled by some tired Epson projector.
    As far as slides go, scan them in at 150 dpi or better, and make them at least the dimensions of your presentation.  Keynote is really only wanting 72dpi, but I do them at 150, just in case I need to print out the presentation as a handout later, and having the pix at 150 dpi gives me a little help with their quality on a printer.
    You'd probably have to drop in the 150 versions again if you output the Keynote to .pdf or Word or something, but at least you have the option.
    And Gary's right (above) go ahead and scan them as TIFFs.  Sooner or later you'll want to do something else with these slides (like make something for an iPad or the like) and having them as TIFFs keeps your presentation looking good.
    Finally, and this is a big one, get to the location for your presentation ahead of time if you can, and plug the laptop in and see what you get.  There's always connection problems. Don't let the AV bonehead tell you everything will work just fine ('... I don't have any adapters for a Mac...') .  See it for yourself... you're the one that's standing up there.  Unless it's your boss, then you better be really sure it works.

  • HT5312 I can not use my account to buy applications inside because I forgot the answers safety questions

    I can not use my account to buy applications inside because I forgot the answers safety questions

    You need to contact Apple. Click here, phone them, and ask for the Account Security team.
    (86795)

  • Why i didnt recieve notifications from msn application and facebook application if some body messaged me although all the settings are on???

    why i didnt recieve notifications from msn application and facebook application if some body messaged me although all the settings are on???

    Do you mean Account Settings in iPhone's Facebook app?

  • Error using DOS Command from Java

    Hi,
    I am using the following code to execute the DOS command to delete a file from Java.
    cmd = "del " + fileName;
    Runtime run = Runtime.getRuntime();
    Process proc = run.exec(cmd);
    Getting the following exception during runt time.
    Exception = java.io.IOException: CreateProcess: del D:\LAWDOCS\P50074\12\3\36857.3  error=2 --
    Can some body throw light on this?.
    Thanks,
    Jeyaraman R

    "del" is not an actual executable file, but instead a command in the command interpreter. So you can't just execute del like that, you have to run the command interpreter and tell it to execute the del command.
    If you are on windows NT, 2000 or XP, replace your command with "cmd /C del " + filename.
    If you are on Windows 95, 98 or ME, use "command /C del " + filename. (I am not quite sure if the switch for this is called /C on old windows version.)
    (But why not use File.delete()?)

  • Using word/excel from java (client or weblogic server)

    Hi everybody,
    i want to use excel / word functionality from java in two different variants:
    -> serverside
    -> clientside
    I tried the weblogic.comc and i got serveral classes but in the remote-package i got only a utitlity-class.
    My knowlege about COM is rather bad.
    Does anybody did this bevor and
    -> can say me, if it is correct, that i only got a utility-class (so how will i use it from the client ?!)
    -> has a example for using Excel / Word from Java in bea weblogic
    -> has a example for using Excel / Word directly in a client (not via rmi)
    Thanks
    Ciao
    Sven

    Sven, This is a really bad idea. Why don't you tell me
    what your trying to do and I wil surely give you a better alternative
    JRadecki
    "Sven Roesner" <[email protected]> wrote:
    >
    Hi everybody,
    i want to use excel / word functionality from java in two different variants:
    -> serverside
    -> clientside
    I tried the weblogic.comc and i got serveral classes but in the remote-package i got only a utitlity-class.
    My knowlege about COM is rather bad.
    Does anybody did this bevor and
    -> can say me, if it is correct, that i only got a utility-class (so how will i use it from the client ?!)
    -> has a example for using Excel / Word from Java in bea weblogic
    -> has a example for using Excel / Word directly in a client (not via rmi)
    Thanks
    Ciao
    Sven

  • Use a scanner from Java

    Hi all!, someone knows about an API that let me use a scanner from Java?
    without programing JNI code.
    thks in advance!.

    The Java Twain package from http://www.gnome.sk does exactly what you need. You do not have to bother about jni, you can get an image from the scanner directly from your java application.
    Erika

Maybe you are looking for

  • Photoshop CS6 Action Player Bug Make Adjustment Layer Applied to all to be Clipped

    On Oct.  11, 2010 I received the following from Adobe Support Hi John, This is to inform you that  we have been able to reproduce the same {Photoshop Actions} behavior at our end. So we have logged this issue with the Product Team and Engineering Tea

  • Preview template in browser Doesn't  work

    Hi I'm trying to preview a template I have made with DW in IE but it won't work. When I do this a dialog window pops up and asks me if I want to open or save it, if I shoes open, it opens in frontpage. It says that it is a Frontpage template, I have

  • Chapter names in .indb

    When adding documents to an InDesign book (.indb) and then exporting the book for Digital Editions, the resulting epub's table of contents (.ncx) name the chapters whatever the file name for that chapter was. How can I change the name of the chapter

  • How do reduce the space between the front panel and the display area

    I am trying to reduce the space between the front panel and display area but i am not able to reduce the space

  • Getting ditributed  timeout  error

    Hi, when i 'm executing a procedure using dblink i'm getting following error ERROR at line 1: ORA-02049: timeout: distributed transaction waiting for lock ORA-02063: preceding line from PROD ORA-06512: at "PURGE.PURGEPERSON", line 111 ORA-06512: at l