Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jdbc connectivity

843859Mar 20 2008 — edited Mar 23 2008
Hello Friends,
I am using Oracle10g as the database and jdk1.6.0, by the follwing code i am not able connect to the database and the exception at compline time is
unreported exception java.lang.classnotfoundexception; must be caught or declared to be thrown
Class.forName("oracle.jdbc.driver.OracleDriver");


import java.sql.*;
import java.lang.*;
import java.io.*;

public class db
{
public static void main (String args[]) throws SQLException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin@localhost:1521:XE","SYSTEM","tiger");
System.out.println("connected");
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 20 2008
Added on Mar 20 2008
15 comments
554 views