The process of using JDBC to connect to the database is as follows:
Register the driver: Class.forName(”driverName”); For example, sun.jdbc.odbc.JdbcOdbcDriver Connection con = DriverManager.getConnection(”url,”myLogin”,myPassword”); For example url may be jdbc:odbc:dsn_name. Creating the JDBC Statement and Retreiving: Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query);
Liked By
Write Answer
How do you connect to the Database in Java ?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
16-Jul-2015