
import java.sql.*; public class OdbcSqlServerConnection { public static void main(String args[]) throws Exeption { Connection con=null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER;user=DTHOTA;password= "); System.out.println("First Connection ok."); con.close();
java.util.properties prop = new java.util.properties(); prop.put("user", "DTHOTA"); prop.put("password", " "); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER", prop); System.out.println("Second Connection ok."); con.close(); } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); } } }
}
After writing this code, i am getting an error as
OdbcSqlServerConnection.java:29: class,interface or enum is expected How to fix it.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.