Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC Oracle Database error

Have Programming Question? Ask it here!
 
 
 


Abhishek
Oracle Database error
1 Answer(s)      4 years and a month ago
Posted in : JDBC


String query11 = "SELECT product_code, product_quantity, price FROM o"+orderid;
ResultSet rs11 = stmt.executeQuery(query11);
while(rs11.next()){
product_code[j] = rs11.getString("product_code");
product_quantity[j] = rs11.getInt("product_quantity");
product_price[j] = rs11.getLong("price");
j++;
out.println(product_code[j]);
out.println(product_quantity[j]);
out.println(product_price[j]);
out.println(j);
}
rs11.close();

This is my code.
I want to save Result set values in array.
The query is correct.
But the values i'm printing is 0 or null.
I don't know exactly where is the problem?

Advertisement
View Answers

June 16, 2010 at 3:34 PM


Hi Friend,

Try the following code:

import java.sql.*;
class Select {
public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/register";, "root", "root");
Statement st=connection.createStatement();
ResultSet rs=st.executeQuery("select * from item");
rs.last();
int count = rs.getRow();
rs.beforeFirst();
int id[]=new int[count];
String name[]=new String[count];
int price[]=new int[count];
int k=0;
while(rs.next()){
id[k]=rs.getInt("itemid");
name[k]=rs.getString("Item_Name");
price[k]=rs.getInt("price");
k++;
}
for(int i=0;i<id.length;i++){
System.out.println(id[i]+" "+name[i]+" "+price[i]);
}
}
catch(Exception e){
}
}
}

Hope that it will be helpful for you.
Thanks


Related Tutorials/Questions & Answers:
error oracle database connection?
error oracle database connection?  hi now i am trying to connect oracle database and also insert my data into table, but it's not working.. I created... in oracle table. my table name is logininfoclient_sla. this is my coding
Oracle Database error - JDBC
Oracle Database error   String query11 = "SELECT product_code, product_quantity, price FROM o"+orderid; ResultSet rs11 = stmt.executeQuery(query11); while(rs11.next()){ product_code[j
Advertisements
error in uploading image from jsp to oracle 10g database
error in uploading image from jsp to oracle 10g database  ... try to insert into the image into the database i got the above error please advice how to get rid of error   JSP upload image in Mysql database
Oracle Database connectivity probem
Oracle Database connectivity probem  hi Below is the code of oracle database connectivity, when i compile it, it will show the error... also set the environment variable like that .;E:\oracle\ora81\jdbc\lib
File insertion into oracle database
File insertion into oracle database  How to Read and Insert a file (any format) into a Oracle database
storing csv into oracle database
storing csv into oracle database  i want jsp code for storing csv file into oracle database
error occured in oracle - JDBC
error occured in oracle  hi... this is the error i got in oracle 11g when i am trying to insert image ORA-00984:column not allowedd here for the insert statement like this insert into imgapp('1','xxx','G:\image folder\ultrasound
Spring and Oracle Database
Spring and Oracle Database  I need example for Batch update process using oracle database and spring framework with full explanation
Oracle 9i database problem
Oracle 9i database problem  Hi Somebody has given the solution but i... Oracle 9i in my laptop.and i got sql+ page ok.i have gone to control panel->odbc->in that i correctley configured DNS and TNS and tested the Oracle
About connection database oracle to java
About connection database oracle to java  Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... .but it has shown error in TNS .what exactly i did is that i have gone
About connection database oracle to java
About connection database oracle to java  Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... .but it has shown error in TNS .what exactly i did is that i have gone
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle... .but it has shown error in TNS .what exactly i did is that i have gone to control Panel>>Administrative Tools>>Data Sources in that i selected Oracle
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle... .but it has shown error in TNS .what exactly i did is that i have gone to control Panel>>Administrative Tools>>Data Sources in that i selected Oracle
About connection database oracle to java
About connection database oracle to java  **Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... as tiger .but it has shown error in TNS .what exactly i did is that i have gone
oracle insert statement error - JDBC
oracle insert statement error  hi.. please help me to insert a image into oracle 11g database and please say me how can i insert image from directory like G:\imagefolder\ultrasoundimage\02us02.jpeg please help me
android connection to database oracle 10g
android connection to database oracle 10g  Hello, How i can connect my android application to my oracle 10g database
Connecting Oracle database with struts - Struts
Connecting Oracle database with struts  Can anyone please provide me some solutions on Connection between Oracle database and struts
Java Connection to Oracle database
Java Connection to Oracle database  HI I am ubable to connnect jdbc to Oracle database.i had gone to control panel >>Administrative tool>>>Data source,in that forDNS name i typed Oracle and in TNS i culdn't
jsp with database oracle
jsp with database oracle  hai i am doing one program in jsp i want to check the jsp life cycle methods so wrote one program, in which i write jspInit() method and jspDestroy() methods. but i am getting error i crate a table
Oracle Database - Insert System Time
Oracle Database - Insert System Time  Hi I want to insert only system time dynamically using a statement but not a prepared statement into Oracle Database please suggest me any code
write excel file into the oracle database
write excel file into the oracle database  dear sir, i need the jsp code that reads the excel file and stores it into the oracle database table..and also i need the code to connect oracle database? thank u in advance
Database Connectivity Withe Oracle
Database Connectivity Withe Oracle  Develop a program to perform the database driven operation like insert, Delete, Update and select. To perform the above operations create one table named Employee. Field Name Field Type EmpId
oracle database backup using jsp
oracle database backup using jsp   I want to take the backup of oracle database.I want to write the code in jsp ,so that when the page is loaded a backup of the database is stored in one of my local drives.Is it possible to do
error at the oracle programm with jsp - JSP-Servlet
error at the oracle programm with jsp  an error occured at myodbc:jdbc:missig comma
Java Barcode Program with Oracle database
no and serial no of the item being scanned to Oracle 10g database. I dont have any...Java Barcode Program with Oracle database  Hi Everyone, I need help to develop my new project, am going to do with barcode s/w, am very new
store & retrive the image from oracle database
store & retrive the image from oracle database  how can i store the image path in tha database & fetch that image from oracle database
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error  import java.io...."); con=DriverManager.getConnection("jdbc:oracle:thin...) { e.printStackTrace(); } } } ---> I found Error below how i can solve this error plz
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error  import java.io...."); con=DriverManager.getConnection("jdbc:oracle:thin...) { e.printStackTrace(); } } } ---> I found Error below how i can solve this error plz
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
unable to get datas from oracle database
unable to get datas from oracle database  Dear Sir, I am again struck in my project.. i want to display data from oracle database but i get this error when i run the jsp file in tomcat, I post my code below.. kindly let me
How to connect to the database to my application if my database is made up in oracle
How to connect to the database to my application if my database is made up in oracle   How to connect to the database to my application if my database is made up in oracle
REQ for connection b/w jdbc and oracle database
REQ for connection b/w jdbc and oracle database    REQ for connection b/w jdbc and oracle database    The Java classes to connect... tell the Oracle driver which method you want to use to connect to the database
insert user session into other oracle database table
insert user session into other oracle database table   hello i am a doing my project in jsp-servlet. i have doubt that when a user login to his... table. with user id i also want to insert date and current time in to database
Dropdown code to retrieve result from oracle database
Dropdown code to retrieve result from oracle database  Hi Friends, I... retrieve the result from Oracle database.We have procedures created already.Just... that will retrieve values from the database into dropdown. As the user choose any option
How to connect to database to my application if the database is made up in oracle
How to connect to database to my application if the database is made up in oracle  How to connect to database to my application if the database is made up in oracle   Hi Friend, Follow these steps: 1) Import
Select tag to fetch data from oracle database
Select tag to fetch data from oracle database  I created a select box having more than one menus in the select box such as regnno, address and name... oracle database.Similarly when address will be selected by the user from
fetch record from oracle database using jsp-servlet?
fetch record from oracle database using jsp-servlet?  how can i fetch data from oracle database by using jsp-servlet. i'm using eclipse, tomcat server and oracle database and creating jsp pages and also using servlet
how to get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   </script> </head> <body> <select name...("jdbc:oracle:thin:@192.168.149.95:1521:MOBIRAC1","SCOTT","SCOTT"); Statement
if my database(oracle) connection failure means wat is the code to write in exception ?
if my database(oracle) connection failure means wat is the code to write in exception ?  if my database(oracle) connection failure means wat is the code to write in exception
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide  how to connect jsp to oracle database connections in netbeans ide?pls provide screenshots if possible
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide  how to connect jsp to oracle database connections in netbeans ide?pls provide screenshots if possible
error log and send Database
error log and send Database  hi my requirement is validate xml and xsd in java.If there is an errors then i will log error and store into error table. so plz if any one knows send code urgent. error table details
Applet to database error - Applet
Applet to database error  Hi... I had an application where i need to connect to the database for the values to display in the applet.... Following... necessary for finding the error... as itz only drawing strings or lines
how to display or retrive an image in jsp whose path is stored in oracle database
how to display or retrive an image in jsp whose path is stored in oracle database  how to display or retrive an image in jsp whose path is stored in oracle database and the image is stored in my pictures folder
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database... be inserted into oracle database.. please help me sir...   hi friend..., in these examples MySQL is used as database system if you want to use the Oracle
Database error - WebSevices
Database error  Hello, How i connect my database file& tables to Zend library file Using PHP language. In which library file i should change that code. Any one know the exact changes. Tell me.   http
connection database error
connection database error  import java.awt.EventQueue; // import packages import java.awt.event.ActionEvent; import java.awt.event.ActionListener...;which type of error occurs? Specify it. Is NWIND is your dsn
Database Error - Hibernate
Database Error  Hi, I am working with Struts 1.2---- AJAX-----Hibernate 3.0 --- MySQL 5.0. At the time of inserting/fetching from Database... exceeded; try restarting transaction That means the database becomes locked. Can
java script unable to connect to oracle database and insert data
java script unable to connect to oracle database and insert data  ... is to insert data from jsp to oracle database 8, so i create a table in oracle... jsp coding in rose india for sql and i changed the drivers for oracle.. when i try
Advertisements
 

 

 

DMCA.com