Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle connection with java

Re: Oracle connection with java

From: godmann <allanwtham_at_yahoo.com>
Date: 17 Sep 2001 21:24:38 -0700
Message-ID: <95cd51c.0109172024.7c30ca2b@posting.google.com>


Hi there,

 Something like this will be fine...



public class Allan extends HttpServlet {
	// jdbc:oracle:thin:@myhost:1521:orcl
  static String   url	=	"jdbc:oracle:thin:@pegagus:1521:mstr";
  static String  driver	=	"oracle.jdbc.driver.OracleDriver";
  public void init(ServletConfig config) 
	throws ServletException	{
	  super.init(config);
	  log("DatabaseServlet.initialize: starting");
      try {
		//loading the driver 
		Class.forName(driver).newInstance();
	  } catch(Exception e) {
		  e.printStackTrace();
		  String errmsg =	e.getMessage();
		  System.out.println("Failed: " + errmsg);
		}
	}


  Note:

   url	=	"jdbc:oracle:thin:@pegagus:1521:awt";
   driver =	"oracle.jdbc.driver.OracleDriver";

   pegagus is your server name, awt should be your database.   

Allan W. Tham
DBA Received on Mon Sep 17 2001 - 23:24:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US