My proj involves JSP @ front end n MySql @ back end and connectivity is established thru JDBC. The thing is when i store values from the front end into the db i need to change the data types n vice versa.Consider ths.
I m retrieving date from the db thru the result set i m traversing thru each n every record(next() function is used).
String d1 = rs.getString(2) ;System.out.pri ntln("Date="+da te);
How do i convert the date field into a java.sq.Date value such dat it can be retrieved back @ front end? If i directly the variable d1(mentioned above) as java.sql.Date then there is arises compatibility error....
Help me pls..........
9 6553
My proj involves JSP @ front end n MySql @ back end and connectivity is established thru JDBC. The thing is when i store values from the front end into the db i need to change the data types n vice versa.Consider ths.
I m retrieving date from the db thru the result set i m traversing thru each n every record(next() function is used).
String d1 = rs.getString(2) ;System.out.pri ntln("Date="+da te);
How do i convert the date field into a java.sq.Date value such dat it can be retrieved back @ front end? If i directly the variable d1(mentioned above) as java.sql.Date then there is arises compatibility error....
Help me pls..........
Hi,
Can u make urself more clear? when do you want to convert the date :
1. while sending date from jsp to mysql or
2. while getting date from db and sending it to jsp.
Hi,
Can u make urself more clear? when do you want to convert the date :
1. while sending date from jsp to mysql or
2. while getting date from db and sending it to jsp.
while getting date from db and sending it to jsp
while getting date from db and sending it to jsp
Hi,
then db itself retunrs date in sql format, isn't it ?
My proj involves JSP @ front end n MySql @ back end and connectivity is established thru JDBC. The thing is when i store values from the front end into the db i need to change the data types n vice versa.Consider ths.
I m retrieving date from the db thru the result set i m traversing thru each n every record(next() function is used).
String d1 = rs.getString(2) ;System.out.pri ntln("Date="+da te);
How do i convert the date field into a java.sq.Date value such dat it can be retrieved back @ front end? If i directly the variable d1(mentioned above) as java.sql.Date then there is arises compatibility error....
Help me pls..........
Have a look at this Code. -
Calendar c = new GregorianCalendar();
-
c.setTime(rs.getDate(2));
-
int day = c.get(Calendar.DATE);
-
int month = c.get(Calendar.MONTH);
-
int year = c.get(Calendar.YEAR);
-
String date_str = ""+day+"/"+month+"/"+year;
-
Are you looking for this?
Then go and enjoy with this code.
Good Luck!
Kind regards,
Dmjpro.
Hi,
then db itself retunrs date in sql format, isn't it ?
Yes bt i wanna convert the sql format date to java compatible date format. Wht to do for that?
Yes bt i wanna convert the sql format date to java compatible date format. Wht to do for that?
Have a look at my Code.
Then you will understand by yourself.
Kind regards,
Dmjpro.
Have a look at my Code.
Then you will understand by yourself.
Kind regards,
Dmjpro.
date_rs_test.ja va:36: cannot find symbol
symbol : variable Calendar
ths s the error dat i got....
date_rs_test.ja va:36: cannot find symbol
symbol : variable Calendar
ths s the error dat i got....
Open the API docs for ResultSet and you will see that there is a getDate method.
date_rs_test.ja va:36: cannot find symbol
symbol : variable Calendar
ths s the error dat i got....
Kind regards,
Dmjpro.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing/modifying the code.
Thank you.
.. Facundo
|
by: Dan Anderson |
last post by:
I ran a search through the mySQL manual and google and could not find a
satisfactory answer. Does mySQL support the declaration of a boolean
data type? Currently I am using VARCHAR(6)s with either 'TRUE' or
'FALSE' and would like to cut down on the storage.
Thanks in advance,
Dan Anderson
|
by: Hui |
last post by:
Hi gurus,
I'm having data conversion (marshalling) problems with VB.NET DLL calling a old C DLL. The problem is that when the return type is a Long, I'm getting some garbage large number. eg. 921312343243543 or -3123904538
I've tried both Declare and DllImport but getting the same error. I've tried MarshalAs(UnmanagedType.U8) but no help. Convert.UInt64 doesn't do it either.
This is really odd as return type of int and boolean seems to...
|
by: Amir |
last post by:
Hi all,
I have a table called PTRANS with few columns (see create script below).
I have created a view on top that this table VwTransaction (See below)
I can now run this query without a problem:
select * from dbo.VwTransaction
where
|
by: rdraider |
last post by:
I'm doing a data conversion project, moving data from one SQL app to
another.
I'm using INSERT INTO with Select and have the syntax correct. But when
executing the script I get:
Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to float.
Is it possible to change the data type during the INSERT INTO statement?
| |
by: Ian Robinson |
last post by:
Hi,
I'm converting a desktop application Delphi/Paradox to a web server
application PHP/MySQL
What data type should I use in MySQL for the following paradox datatypes ?
Boolean ?
Currency ?
|
by: runsun |
last post by:
I am new in PHP/Mysql. I want to input sth from website to mysql, then output the formatted data to .txt, and finally use Excel to open the .txt file. I believe there are better and simpler ways than what I did. But I want to know what's wrong in my codes. Here are the details:
In survey.html, I need people input their ID and comment.
In Mysql, I've already made the survey table.
I use survey_result.php to import people's input to that table...
|
by: John Moore |
last post by:
My mysql data type is double(16,2) with '0.00' specified as default.
These represent dollars and cent amounts.
My question is: How do I perform simple mathematical operations on
these money amounts without PHP changing them to integers? I only need
to add or subtract these numbers without any rounding or chopping off
of the '.00' if they come up zero cents.
Looking at the PHP docs, the only helpful suggestion I could find is
that if...
|
by: markwalsen |
last post by:
I've been quite pleased with linking via MySQL Connector / ODBC 3.51
from Access to a remote MySQL database. However, I haven't figured
out how to establish the link between a Data Type = Attachment field
in Access and some corresponding MySQL field (BLOB, BINARY, I'm not
sure what would work).
Depending on what SQL datatype I define for this field, when I import
that field (link) into the Access table, the Access data type is
either...
|
by: dkyadav80 |
last post by:
Hi guys,
I have a form in html , all description below:
first: name of persion (input type box)
second: job profile (input type box)
third: experience from: list box (Month : Jan, Feb,.. format) and
experience to: list box (year: 2008,2007,2006,...)
In Mysql database only 4 filed,
1. Name(data type - varchar),
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |