import java.sql.*;
public class Conn
{
Connection con;
String database;
Statement stat;
Conn()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String database="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Insurance.mdb;";
con=DriverManager.getConnection(database,"","");
stat=con.createStatement();
if(con.isClosed())
{
System.out.println("Closed");
}
else
{
System.out.println("Open");
}
}
catch(Exception ex)
{
System.out.println("Exception : "+ex);
}
}
public static void main(String args[])
{
new Conn();
}
}
No comments:
Post a Comment