Ravi Harishchandra

Greenhorn
+ Follow
since Oct 29, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ravi Harishchandra

Hi... I'm trying to retrieve the records whose check out dates match with the system date(A hotel room reservation software). But I'm getting the following error java.sql.SQLException: ORA-01722: invalid number

The CODE:::
Hii...the mentioned SQL statement is just not executing, The code is as below:
The error I'm getting is : java.sql.SQLException: Invalid SQL type: sqlKind = UNINITIALIZED
CODE::
Statement st1 = con.createStatement();
st1.executeUpdate("insert into customer values('"+ id1 +"','"+ name +"','"+ addr +"','"+ cont +"','"+ email+"','" + city +"','" + state + "','" + from +"','" + to + "','"+ room +"','" + adv +"','" + room_no +"','"+ differenceInDays +"')"); // the first statement works absolutely fine, inserting all the values in database.
st1.executeUpdate("update" + room + "set FLAG=1 where RNO = " + room_no +"");// this statement here is not executing, values room and room_no are inserted in database in the above SQL query
con.close();
res.close();

Hii Mathew and fred...

The exception statements are added. I did not mention it to reduce the complexity. The first try block has to execute... since it is sending values
to back end. And there are no IF or CONDITIONAL statements to prevent it from executing....I'm posting the codE:
[Added code tags - see UseCodeTags for details]
12 years ago
Hi....I have written a java program in which I have used 2 try-catch blocks. Each try block consists of SQL queries to
updates the database. But the first try block just does not execute. The second one works fine. The connection settings and everything is the same in both.
please help me out on this.

12 years ago
I'm building a web application for hotel room booking system and facing this problem in updating the room nos.
I have a table (AC) which has a room_no and flag column. When the room is occupied the flag will be set to 1 or else 0. I'm not able to
set the flag when the first room gets filled( i.e Flag of room 1001 = 0);

The code I've used is::
12 years ago
Thanks ...got it....it was a problem with tomcat libs.....reinstalling solved it.
12 years ago
Hi...I'm trying to connect my web-application to MySql (database), from ECLIPSE I am getting a runtime error stating :java.lang.ClassNotFoundException: com.mysql.jdbc.Driver.

I have added the eternal (JAR file) mysql-connector-java-5.1.22.zip. But still I'm getting the error.

The code:
Connection con = null;
try
{
Class.forName("com.mysql.jdbc.Driver"); // This is where the run-time error occurs (ClassNotFoundException)
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/brb","root","123");
Statement st = con.createStatement();
st.executeUpdate("insert into test values('" + name + "','"+ value +"')");
}catch(Exception e)

Note: This works absolutely fine on NetBeans....
12 years ago
`I don't want to call the class..what i what to do is send all the data from Servlet to core java class. Can you post the exact code??
12 years ago
Hii.... I am developing a web application. I have got all the data from HTML to my Servlet page using request.getparameter. Now I want to send that data to controller i.e. (register.java) from where they will
be sent to the database. How shall I do that?? I need to send all the data e.g(name, age, DOB etc). from Servlet to core java class.
12 years ago

Jeff Verdegan wrote:

Mark Butcher wrote:
Now, how to convert oracle DATE into java.util.DATE to find the difference in days ?



There's no such thing as "convert oracle DATE into java.util.DATE to find the difference in days". At least, not without you making it.

There are two main parts to your question:

1) Convert oracle DATE into java.util.DATE. This is accomplished by calling ResultSet.getDate(...).

2) Find the difference between two dates. I believe that is answered in this thread.

So, what specifically are you having trouble with?



@Jeff Verdegan :: If you have dates stored in Oracle you can write a simple function to get the number of days.....then all you need is to retrieve that integer value.......
Will post that function in sometime....also Oracle 11g Release 2 has excellent features regarding date manipulation.....hope this solves your problem
12 years ago
@Jeff Verdegan :: If you have dates stored in Oracle you can write a simple function to get the number of days.....then all you need is to retrieve that integer value.......
Will post that function in sometime....also Oracle 11g Release 2 has excellent features regarding date manipulation.....hope this solves your problem
12 years ago
Thanks buddy.....the problem is solved.......
12 years ago
I'm new to this site....can you post that thread you mentioned for me?? Regarding the code...yes you do get the object but that's the dead end for it....
You cannot process it further( considering my knowledge:::: working on java first time------pretty different from .NET that;s why) or maybe there is another way....i don't know...
please can you give me the exact code for that...should i upload the entire application so that you get a better understanding....
waiting for your reply...do let me know
12 years ago
I have pasted the code below and will also give a screen shot of the same

CODE:
Date dateFromDateChooser = jDateChooser1.getDate();
String dateString = String.format("%1$tY/%1$tm/%1$td", dateFromDateChooser);
dateFromDateChooser = jDateChooser2.getDate();
String dateString1 = String.format("%1$tY/%1$tm/%1$td", dateFromDateChooser);

The 2 different Date Choosers are used to choose the different dates....I'm unable to get the total number of Days from the above code.
12 years ago
The functionality of the plug-in is different......you get the time /date in IS format.....but i'm unable to subtract the dates...all that i've done is or can be done is
convert it into string...can you tell me if is it possible to reconvert it into integer(the date stored as String) then subtract it.....
also should i upload the jCalender plug-in so that you can have a look??
12 years ago