Re: Oracle connection with java
From: godmann <allanwtham_at_yahoo.com>
Date: 17 Sep 2001 21:24:38 -0700
Message-ID: <95cd51c.0109172024.7c30ca2b_at_posting.google.com>
public class Allan extends HttpServlet {
Date: 17 Sep 2001 21:24:38 -0700
Message-ID: <95cd51c.0109172024.7c30ca2b_at_posting.google.com>
Hi there,
Something like this will be fine...
public class Allan extends HttpServlet {
// jdbc:oracle:thin:_at_myhost:1521:orcl
static String url = "jdbc:oracle:thin:_at_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:_at_pegagus:1521:awt"; driver = "oracle.jdbc.driver.OracleDriver";
pegagus is your server name, awt should be your database.
Allan W. Tham
DBA
Received on Tue Sep 18 2001 - 06:24:38 CEST
