• Post Reply Bookmark Topic Watch Topic
  • New Topic

java database connectivity...  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!!! this is sanjay gajera
i want to know that how to connect the java applicaation to the database ....Access...please tell me this solution with exampale of small database ACCESS based application...as soon as possible.....
thanks....
 
Author and ninkuma
Marshal
Posts: 66345
155
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public void getConnection() {
try {
java.sql.Connection con = null;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("sun.jdbc.odbc.JdbcOdbcDriver found");
con = DriverManager.getConnection("jdbcdbc:CtsEmployee", "", "");
} catch (Exception cnfe) {
System.out.println("Error: sun.jdbc.odbc.JdbcOdbcDriver not found");
}
}

This is some snippet of code for access connection where CtsEmployee is some dataourse
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!