import java.sql.*; public class JavaApplication4 { /** * @param args the command line arguments */ private static Connection link; public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); link = DriverManager.getConnection("jdbc:odbc: asd ","",""); System.out.println("Connected to database"); } catch(ClassNotFoundException cnfEx) { System.out.println("* Unable to load driver! *"); System.exit(1); } catch(SQLException sqlEx) { System.out.println("* Cannot connect to database! *"); System.out.println(sqlEx.getMessage()); System.exit(1); } try { link.close(); System.out.println("Disconnected to database"); } catch(SQLException sqlEx) { System.out.println("* Unable to disconnect! *"); System.exit(1); } } }
* Cannot connect to database! * [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)