On 22 Jan 2003 at 0:00, sufi malak <[EMAIL PROTECTED]> wrote:
> import java.sql.*;
> public class JDBCExample {
> public static void main(String[] args) {
> try {
> Class.forName("oracle.jdbc.driver.OracleDriver");
> Connection conn = DriverManager.getConnection(
> "jdbc:oracle:thin:@majid:1521:test",
> "scott", "tiger");
> System.out.println("Got connected");
> ...
In addition to the suggestions to add classes.zip to lib directory, I
would have put a little more infrastructure here to make sure the
driver is known to the driver manager. Specifically:
try {
// Load the driver class
Class drvr = Class.forName("oracle.jdbc.driver.OracleDriver");
// Register reference to the loaded class with the driver mgr
DriverManager.registerDriver(drvr);
// Get a connection
Connection conn = ...
...
}
...
Hope that helps.
---
Alan Meyer
AM Systems
Randallstown, MD
U.S.A.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com