how can connection with oracle10g with java

Answer Posted / kishan

package dao;
import java.sql.Connection;
import java.sql.DriverManager;
public class Database {
static final String USERNAME="hr";
static final String PASSWORD="hr";

public static Connection getConnection()
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:XE",
USERNAME, PASSWORD);
return con;
}
catch(Exception ex) {
System.out.println(ex.getMessage());
return null;
}
}
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the jdbc statements?

553


What are the differences between stored procedure and functions?

470


Does jdbc use ssl?

494


If you are truncated using JDBC, how can you that how much data is truncated?

579


What is a java driver?

500






What is an advantage of using the jdbc connection pool?

446


What is com mysql jdbc driver?

498


What is while rs next ())?

494


What does the jdbc resultsetmetadata interface?

548


What are the steps required to execute a query in jdbc?

528


How can you make a connection?

531


What does jdbc stand for?

501


What class.forname does, while loading the drivers?

531


What is jdbc and odbc in java?

491


What are the packages are used in jdbc?

567