linking java front end to oracle database - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

linking java front end to oracle database

cherry1cherry1 Posts: 19Member
hi!
i want to create the front end to my oracle8 database in java. suppose i have a form with text boxes, i want to insert values in my database tables so that the values in text boxes becomes a new row in table and so on and so forth.
can anyone point me in the right direction, so im able to figure out how to do this?

Comments

  • dehadedehade Posts: 31Member
    : hi!
    : i want to create the front end to my oracle8 database in java. suppose i have a form with text boxes, i want to insert values in my database tables so that the values in text boxes becomes a new row in table and so on and so forth.
    : can anyone point me in the right direction, so im able to figure out how to do this?
    :

    Take a look at JDBC. It allows you to connect to database and query and mutate tables via SQL statements. See http://java.sun.com/products/jdbc/ for more information
  • cherry1cherry1 Posts: 19Member
    hi!
    i googled up a storm and managed to write this, the code below compiles with out error but on running it gives:

    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    [code]
    public static void main (String args[]) throws SQLException
    {
    try
    {

    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:thin@localhost:1521:[b]orcl[/b]";
    Connection conn = DriverManager.getConnection (url, "scott", "tiger");
    Statement stmet = conn.createStatement();
    ResultSet rst = stmet.executeQuery ("select ename from emp");
    while (rst.next())
    System.out.println (rst.getString(1));
    }
    catch (Exception err)
    {
    System.out.println ("Error: " + err);
    }
    }
    [/code]
    ok, this is how much i know:
    1- when creating a connection using the thin driver, i need this URL:
    jdbc:oracle:thin@[database server address]:[port number]:[SID number]
    2- from googling i found i can use this-> jdbc:oracle:thin@[b]localhost:1521[/b]:SID
    but no amount of googling is telling me what SID to use if im using oracle8. plz help.
  • cherry1cherry1 Posts: 19Member
    ok, so non-stop googling told me that i can find the SID in the tnsnames.ora and listener.ora files
    in these files....the [b]SID is orcl[/b]....which i have been using in the above code. so now i dont know y my program wont run.

    am i using the wrong kind of driver?

    am i opening the connection the wrong way?

    is there some problem with 'data source'?

    ps.the emp table is already created once oracle is installed on system

  • arb123arb123 Posts: 696Member
    Is the Oracle DB registered in the ODBC data source applet? (Control Panel > Administrative Tools > Data Sources in WinXP)

    I would use a Java driver if possible; check your DB documentation for the jars/driver name/etc you need.

    ---------------------------------
    [size=1]HOWTO ask questions: http://catb.org/~esr/faqs/smart-questions.html[/size]

  • cherry1cherry1 Posts: 19Member
    : Is the Oracle DB registered in the ODBC data source applet? (Control Panel > Administrative Tools > Data Sources in WinXP)
    :
    : I would use a Java driver if possible; check your DB documentation for the jars/driver name/etc you need.
    :
    : ---------------------------------


    *sits down and cries*
    i dont know how to register it as ODBC data source (although i did try to do it, yesterday). can u plz tell me how to do it? im using oracle 8 (not oracle 8i).
    and plz explain vat u mean by using 'java driver'.
  • arb123arb123 Posts: 696Member
    ODBC is a Windows service that allows a common way to register data sources. You'll have to check your Oracle doc to see how to register it. JDBC is a standard way of accessing RDBMSs using Java. The driver you're trying to use is a bridge between these two systems. However, you should be able to cut ODBC out of the equation using a driver supplied by your DB vendor (Oracle).

    I use DB2 with settings like the following:
    [code]
    Driver: com.ibm.db2.jcc.DB2Driver
    Jars on the classpath: db2jcc.jar;db2jcc_license_cisuz.jar
    URI: jdbc:db2://localhost:50000/DBNAME
    [/code]

    You'll have to find equivalents for Oracle. I'd try the Oracle website; they're bound to have developer forums where you'll find answers to your questions.

    ---------------------------------
    [size=1]HOWTO ask questions: http://catb.org/~esr/faqs/smart-questions.html[/size]

Sign In or Register to comment.