Results 1 to 3 of 3

Thread: java oracle connectivity

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2005
    Location
    INDIA
    Posts
    18

    java oracle connectivity

    hi
    is there anybody to tell hw to connect java with oracle 8 or oracle 9i......
    Thanx ...............

  2. #2

  3. #3
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: java oracle connectivity

    Here is a rough example

    Code:
    try
    {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         String url = "jdbc:oracle:thin:@" + "rs4" + ":" + "1521" + ":" + "devlop";
         Connection con = DriverManager.getConnection(url,"express","care");
         PreparedStatement pst = con.prepareStatement("Select " + sysdate + " from dual");
         ResultSet rst = pst.executeQuery();
         if(rst.next())
        {
           String num = rst.getString(1);
           setVariable(varname,num);
           msg=" OK";
           return num +"";
        }
     }
     catch(Exception e)
     {
     }

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