• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a simple question!help

 
Albert Lee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
who can tell me how to connect oracle with JDBC in
JSP.I use these codes:

I use a thin client.but there is no result in the
jsppage.why?Thanks in advance
[ Edited by Dave to add code tags and remove smiley ]
[ November 19, 2002: Message edited by: David O'Meara ]
 
Kevin Mukhar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Albert Lee:
who can tell me how to connect oracle with JDBC in
JSP.I use these codes:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@192.201.113.54:1521:mainora","ni","iu");
Statement sta=con.createStatement();
ResultSet rs=sta.executeQuery(seclect * from nill);
I use a thin client.but there is no result in the
jsppage.why?Thanks in advance


You don't really have a table named "nill" do you? That would be my first guess as to your problem-- make sure the table you use in the select statement is a valid table. Then ensure your SQL is correct ("seclect" was a typo, right?). Then after you get the ResultSet, you need to page through it and read the data.
You appear to be just beginning JDBC. You may want to search for some tutorials before continuing. Here's one: http://java.sun.com/docs/books/tutorial/jdbc/
[ November 20, 2002: Message edited by: Kevin Mukhar ]
 
Albert Lee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it always throw exception when the programe load
driver.i don't know why?is that mean i should config my client?
 
Kevin Mukhar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Albert Lee:
it always throw exception when the programe load
driver.i don't know why?is that mean i should config my client?

Well, that helps understand a little more. However, if your code is throwing an exception, then you should also post the RELEVANT part of the exception stack trace as part of your question.
So, I will bet the exception you are getting is most likely a ClassNotFoundException, or a NoClassDefFoundError. If that is so, you have a CLASSPATH problem. You may need to go read the Java Tutorial to learn how classpaths work: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html, more classpath info is in the Java FAQ, Q2.4, at http://java.sun.com/people/linden/faq_a.html#setclasspath
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic