aspose file tools*
The moose likes JDBC and the fly likes a simple question!help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "a simple question!help" Watch "a simple question!help" New topic
Author

a simple question!help

Albert Lee
Greenhorn

Joined: Aug 04, 2002
Posts: 18
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 ]

Everyday create your history.
Kevin Mukhar
Ranch Hand

Joined: Nov 28, 2000
Posts: 83
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

Joined: Aug 04, 2002
Posts: 18
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

Joined: Nov 28, 2000
Posts: 83
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: a simple question!help