Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?

991


Explain about Join?

1002


Explain about the drive manager class working?

1100


How does JDBC API helps us in achieving loose coupling between Java Program and JDBC Drivers API?

1070


What is the use of dialect?

1008


What are the basic exceptions in jdbc?

1090


What are types of resultset?

982


What does executequery return in java?

913


What is the role of class.forname while loading drivers?

1000


What is a jdbc connection pool?

932


Discuss the procedure of retrieving warnings?

971


How many jdbc driver types are there?

919


Why do we need jdbc?

1052


How can I get or redirect the log used by DriverManager and JDBC drivers?

930


Is it possible to connect to multiple databases simultaneously? Using single statement can one update or extract data from multiple databases?

1010