import java.sql.*;
import javax.swing.JOptionPane;
public class ConnectionClass
{
public static Connection dbconnect()
{
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","schoolms","schoolms");
return conn;
} catch (Exception e) {
// TODO: handle exception
JOptionPane.showMessageDialog(null, e);
return null;
}
}
}
import javax.swing.JOptionPane;
public class ConnectionClass
{
public static Connection dbconnect()
{
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","schoolms","schoolms");
return conn;
} catch (Exception e) {
// TODO: handle exception
JOptionPane.showMessageDialog(null, e);
return null;
}
}
}
Works-----------
ReplyDelete