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
Can I set up a connection pool with multiple user IDs? The single ID we are forced to use causes problems when debugging the DBMS.
What is jdbc driver in java?
How do I disallow NULL values in a table?
What is a lock in jdbc?
code to insert values/rows into oracle database from a java swing textfield when a button is pressed(using preparedstatements)
DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality. What can I do?
What is new in JDBC 2.0?
What is executequery in java?
Explain the two tier and three tier architecture of jdbc.
Explain the locking system in jdbc?
What is the difference between client and server database cursors?
What is jdbc driver manager?
Is it possible to connect to multiple databases simultaneously?
What is namedparameterjdbctemplate?
Is jdbc faster than hibernate?