Go Back   Java Programming Forums > Java Standard Edition Programming Help > JDBC & Databases


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-03-2010, 01:29 PM
Junior Member
 

Join Date: Mar 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sri latha is on a distinguished road
Default jsp and oracle

hiii, I'm sri latha am getting an error like "null java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state" for the following code which is written in jsp, plz help me to get out of it


<%@ page import = "java.sql.*" %>
<%!
String Url = "jdbcdbc:OnlineShopping";
Connection db = null;
Statement DataRequest = null;
ResultSet result1 = null, result2 = null;
String cate = null, res = null,query1 = null,query2 = null,bid,bn,au;

int pr,ca,nb;
%>
<%
//cate = (String)Session.getValue("id");

//cate1 = Integer.parseInt(cate);

try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
db = DriverManager.getConnection(Url,"scott","tiger");
DataRequest = db.createStatement();
out.println(cate);
query1 = "SELECT CategoryId from Category where category='"+cate+"'";
result1 = DataRequest.executeQuery(query1);
res = result1.getString("CategoryId");
out.println("hi:");
out.println(result1.getString(1));
query2 = "SELECT BookId, Bname, Author, Price, CategoryId, NOB from Book where CategoryId='"+res+"'";
result2=DataRequest.executeQuery(query2);

out.println("<br><br><br><center><table border=2 bordercolor=black bgcolor=#F0F0F0 align=center width=400 height=150><tr><th align=center>BOOKID</th></tr><tr><th align=center>BOOK NAME</th></tr><tr><th align=center>AUTHOR</th></tr><tr><th align=center>PRICE</th></tr><tr><th align=center>CATEGORY ID</th></tr><tr><th align=center>NO.OF BOOKS</th></tr></center>");

while(result2.next())
{
bid = result2.getString("BookId");
bn = result2.getString("Bname");
au = result2.getString("Author");
pr = result2.getInt("Price");
ca = result2.getInt("CategoryId");
nb = result2.getInt("NOB");
out.println("<tr><td align=center>"+bid+"</td><td align=center>"+bn+"</td><td align=center>"+au+"</td><td align=center>"+pr+"</td><td align=center>"+ca+"</td><td align=center>"+nb+"</td></tr>");
}
out.println("</table>");
}
catch(Exception e)
{
out.println(e);
}

%>



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed regarding saving BLOB in oracle using JSP smsouvik_2008 JDBC & Databases 1 26-02-2010 06:09 AM
Oracle and Sun copeg The Cafe 2 31-01-2010 11:00 AM
Database connectivity problem-Oracle Entrant JDBC & Databases 3 11-10-2009 03:08 PM
Oracle brought Sun Fendaril The Cafe 2 21-06-2009 03:48 PM
Connecting to Oracle from within Eclipse kairamr Java IDEs 1 12-11-2008 09:16 PM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 01:58 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.