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
What is jdbc odbc?
What is statement and preparedstatement in java?
What is JDBC DataSource and what are it’s benefits?
What is the use of JDBC DriverManager class?
What is an advantage of using the jdbc connection pool?
What is the execute method in java?
What is the use of the statement in jdbc?
What do you understand by jdbc statements?
What is JDBC Driver interface?
How to connect multiple database in jdbc?
How can we retrieve the file in the oracle database?
What are the utilities of the callablestatement?
What is jdbc drivers in java?
What is a jdbctemplate?
What is db client?