This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc problem with oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc problem with oracle" Watch "jdbc problem with oracle" New topic
Author

jdbc problem with oracle

pras
Ranch Hand

Joined: Apr 04, 2007
Posts: 188
public class OracleJdbcProgram {
public static void main(String args[]){

try {
Class.forName("oracle.jdbc.driver.OracleDriver");

}catch(ClassNotFoundException cnf){
System.out.println("Unable to find the driver class,so unable to load");
cnf.printStackTrace();
}
Connection con=null;
try
{
con = DriverManager.getConnection("jdbcracle:thin:@localhost:2030:googleea", "system","googleearth");

}catch (SQLException se)
{
System.out.println("Failed to connect to database, check the db server status and try again");
se.printStackTrace();
}
try {
Statement st=con.createStatement();
int i=st.executeUpdate("insert into student values('mehra','Mumbai',18,'1bio02')");
System.out.println("number of rows affected..." +i);
}catch(SQLException sqe){
System.out.println("Failed to excute the query,check the query");
}
}
}


my program doesnt show any errors.. just shows a blank console.... without updating the database??
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

pitt842003 please check your private messages.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: jdbc problem with oracle
 
Similar Threads
JDBC
Could not locate DB driver
data mismatch error
returning an int
Errors Running JSP Page