JDBC-ODBC driver loading
I don't know but it is showing error in Driver Loading Portion...
public class GUI
{
public static void main(String[] args) throws ClassNotFoundException,
SQLException, InstantiationException, IllegalAccessException
{
String user = new String();
String pass = new String();
Scanner ui = new Scanner(System.in);
System.out.println("Enter Username:-");
user = ui.next();
System.out.println("Enter Passeord:-");
pass = ui.next();
System.out.println("Driver Loading...");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Connecting to Database");
try (Connection con =
DriverManager.getConnection("jdbc:odbc:connect", "","")) {
System.out.println("Creating Query...");
Statement st = con.createStatement();
String qry;
qry = "INSET into student values('"+user+"','"+pass+"')";
st.executeUpdate(qry);
}
}
catch(ClassNotFoundException | SQLException e)
{
}
}
}
No comments:
Post a Comment