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
Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?
Explain about Join?
Explain about the drive manager class working?
How does JDBC API helps us in achieving loose coupling between Java Program and JDBC Drivers API?
What is the use of dialect?
What are the basic exceptions in jdbc?
What are types of resultset?
What does executequery return in java?
What is the role of class.forname while loading drivers?
What is a jdbc connection pool?
Discuss the procedure of retrieving warnings?
How many jdbc driver types are there?
Why do we need jdbc?
How can I get or redirect the log used by DriverManager and JDBC drivers?
Is it possible to connect to multiple databases simultaneously? Using single statement can one update or extract data from multiple databases?