Convert java.util.Date to java.sql.DateI convert java.util.Date to java.sql.Date this way:java.util.Date utilDate = new java.util.Date();java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());And then send sqlDate to prepareStatement.ps.setDate(1, sqlDate).But I got the date such as dd-mm-yyyy. And I need also take hours,minutes pm(am).How can I get the Date "dd-mm-yyyy hh:mm a"? Bumsys@gmail.com wrote:
> I convert java.util.Date to java.sql.Date this way:
>
> java.util.Date utilDate = new java.util.Date();
> java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
>
> And then send sqlDate to prepareStatement.
> ps.setDate(1, sqlDate).
> But I got the date such as dd-mm-yyyy. And I need also take hours,
> minutes pm(am).
>
> How can I get the Date "dd-mm-yyyy hh:mm a"?
The Java Date holds its data as milliseconds since epoch - you have the hours,
minutes and seconds down to the millisecond in there already.
If you are asking how to *display* the Date down to the second, then consider
using things like
<http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html>
or
<http://java.sun.com/javase/6/docs/api/java/util/Calendar.html>
If you're asking how to get the database to *store* the date to a certain
resolution, that depends on how you define the column in which you store the
data, which in turn depends on the SQL dialect your DBMS uses. Check the docs
for your DBMS, and if necessary redefine the column to hold the...
Cast from java.util.DATE to java.sql.DATEDB ORACLE
Calendar stCal = Calendar.getInstance();
stmt.setDate(COLUMN_DATA, stCal.getTime());
doesn't work because setDate method
Sorry for the first post....
DB ORACLE
Calendar stCal = Calendar.getInstance();
stmt.setDate(COLUMN_DATA, stCal.getTime());
doesn't work because setDate method (int, java.sql.Date) in the type
PreparedStatement is not applicable for the arguments (int, java.util.Date)
If I try with:
stmt.setDate(COLUMN_DATA, (java.sql.Date)stCal.getTime());
I obtain a class cast exception
Any solution? How can I insert a java.util.date obtained from a calendar
object in a Oracle DB (java.sql.Date)?
thanks in advance
Dom
On 01.02.2005 12:36 Dom wrote:
>
> Any solution? How can I insert a java.util.date obtained from a calendar
> object in a Oracle DB (java.sql.Date)?
>
Calendar stCal = Calendar.getInstance();
java.util.Date utlDate = stCal.getTime();
java.sql.Date sqlDate = new java.sql.Date(utlDate.getTime());
stmt.setDate(COLUMN_DATA, sqlDate);
Thomas
"Thomas Kellerer" <NNGNVRDSJEBN@spammotel.com> schrieb im Newsbeitrag
news:3698dfF4v06i6U1@individual.net...
>
>
> On 01.02.2005 12:36 Dom wrote:
> >
> > Any solution? How can I insert a java.util.date obtained from a
calendar
> > object in a Oracle DB (java.sql.Date)?
> >
>
> Calendar stCal = Calendar.getInstance();
> java.util.Date utlDate = stCal.getTime()...
Converting java.util.Date to java.sql.DateHello Friends
In my program i am using the following codes:
Date today = new Date();
log.debug("today is"+today);
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-mm-dd");
String todayStr = fmt.format(today);
log.debug("todayStr value"+todayStr);
java.sql.Date dt = java.sql.Date.valueOf(new String(todayStr));
log.debug("current Dt is:"+dt);
The output iam getting is like this:
today is Sat Sep 09 19:20:13 IST 2006(from java.util.Date)
todayStr value 2006-20-09(from string value)
current Dt is: 2007-08-09(from java.sql.Date)
So h...
Printing on AS400 via IBM AS400 Java ToolkitHello all,
I'm working on a program that needs to send a print job to a printer
connected to an AS/400. I've tried using the SpooledFileOutputStream
and I've also tried using one of the SCS Writer classes. Neither
solution is working. With the SpooledFileOutputStream I am at least
able to create my print file, but when my program ends, the file is
still not being printed.
This program does not run on the AS400, it runs on a PC and connects to
the AS400 via the toolkit classes. I know this part works as I am able
to use the toolkit to access Data Queues, Files and Data Areas without
a problem.
Is there anyplace anyone can point me to see some examples of how to
print a file using the AS400 Java Toolkit?
Thanks in advance,
Chuck
Chuck,
What printer data stream is used? or how was the printer data generated?
I am wondering if the data stream being generated matches the data
stream of the printer connected to the iSeries? What printer is attached
to the iSeries and how is it configured?
The iSeries info center has some Toolbox examples:
Programming>Java>IBM Toolbox for Java>IBM Toolbox for Java Classes>
Access Classes>Print>Creating...
Dave
Chuck wrote:
> Hello all,
>
> I'm working on a program that needs to send a print job to a printer
> connected to an AS/400. I've tried using the SpooledFileOutputStream
> and I've also tried using one of the SCS Writer classes. Neither
> solution is working. With the Sp...
warning: [deprecation] in java.util.Date(java.lang.String) has been deprecatedDear Java Programmers,
When compiling my Java program I get the following warning:
"warning: [deprecation] in java.util.Date(java.lang.String) has been
deprecated" on for example this statement:
new Date("09/23/2003")
The code is used to generate the dates on a webpage. Depending on the
language of the webpage
the generated format is different. For example English (see "Date" and
"Choose publication" on the page opened):
http://home.scarlet.be/kenya-belgium/list_5_en/a_kenyan_birthday_party_and_a_belgian_birthday_party.html
French:
http://home.scarlet....
java date problemHi Guys,
I have one question on java date, need to know why 00-00-00 is
converted into 11-30-99.
Appreciate your help.
Thanks
On 29 Aug 2005 13:11:25 -0700, "java_user_082905" <stokekar@gmail.com>
wrote or quoted :
>I have one question on java date, need to know why 00-00-00 is
>converted into 11-30-99.
see http://mindprod.com/jgloss/gotchas.html#DATE
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
In comp.lang.java.advocacy, java_user_082905
<stokekar@gmail.com>
wrote
on 29 Aug 2...
java.util.DateI'm trying to extract the day, month, and year fields from a
java.util.Date object in Java 1.4.
can somebody give me some pointers?
Thanks.
-james
"james tsao" <jtsao@go.com> wrote in message
news:8c426184.0404221049.644ed860@posting.google.com...
> I'm trying to extract the day, month, and year fields from a
> java.util.Date object in Java 1.4.
> can somebody give me some pointers?
> Thanks.
> -james
Look at Calendar.
Silvio Bierman
jtsao@go.com (james tsao) wrote:
> I'm trying to extract the day, month, and year fields ...
java Date problemHi, I've an app where swing clients run all over the globe and a java server
and sybase DB is in the UK.
The users trype in dates "mm/ydd/yyyy" for a "deal" object and these get
translated to a long, sent to the server and stored in the DB. Any user in
any location can look at the deals in their own client and I want to make
sure they all see the same date, (times aren't important).
I want to store the dates as midnight GMT in the DB (datetime col).
Can anyone give me the standard procedure for this? my current effort ain't
working,
I reckon there's ...
Is IBM killing iSeries? Yes, IBM is the iSeries muderer!!!!!This is a multi-part message in MIME format.
------=_NextPart_000_0085_01C4263B.65141F40
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
IBM should know, it's just herself is killing iSeries/400. He invest =
too much money in Webfacing, HATS, PASE, Web Access and RPG V .... but =
how many users are planing to use them??? almost NONE! IBM should focus =
on how to imporve the running time performance of Websphere on iSeries, =
How let user can build java/web application as easy as SDA. AS/400 won =
in 1988 because compare with the Unix, VAX/VMS and DOS, AS/400 is such =
easy to be used to create application system. but now, Java on iSeries =
is nightmare. Compare with Unix, Linux and Window platfrom. Websphere on =
AS/400 has very low performance, It's very difficult to be install, Very =
bad SQL/JDBC performance, to build application is as difficult as unix =
and other open system, even more. Much expensive than unix, linux and =
windows..... so Why user choose iSeries???? almost all my customer =
complain as I said above everyday... Honestly If I was ordered to build =
a web base application, I'd rather use Linux, but not OS/400! OS/400 can =
not give me almost none benefit for Web Application! also AS/400 is not =
a very good DB server too.
Just wish I could install Linux and AIX on AS/400 box without the OS/400 =
primary partition soon. And hope IBM sell the new box as cheaper as =
pSeries (RS/6000).=...
Abandon java.util.Hashtable and java.util.VectorAbandon java.util.Hashtable and java.util.Vector. Use other java.util.Map and
java.util.List implementations instead, such as java.util.HashMap and
java.util.ArrayList, respectively.
While you're at it, don't use java.util.Enumeration; stick with
java.util.Iterator.
-- Lew
On Mar 31, 8:24 pm, Lew <l...@nospam.lewscanon.com> wrote:
> Abandon java.util.Hashtable and java.util.Vector. Use other java.util.Map and
> java.util.List implementations instead, such as java.util.HashMap and
> java.util.ArrayList, respectively.
Tell that the m*th*f*ck*s at Sun wh...
Java on iSeries: setBinaryStream problemHi,
I have got a problem inserting data of a file (both, binary and text) into
a blob column. It is created with "Data BLOB(2G)" in the sql statement (so
the name of the column is obviously 'Data'). I use a PreparedStatement
with the method setBinaryStream. And as far as i can remember it already
had worked until... hm, that's the question! The problem is now that I'm
able to insert files with a size of about 400k. I don't know the exact
size. I have tried it with a 530k-file and this does not work. What
happens is that the method hangs. It...
Problems with Java Garbage Collection on iSeriesHi,
we run into problems with our java application when we produce large
pdf files (>200 pages). This seems somehow to be connected with
garbage collection. Setting the -ms parameter of the virtual machine
to a higher value (e.g. 256m instead of 64m) seems to resolve the
problem but with that setting the whole application has a larger
memory footprint. We get the exception below from the virtual machine
and I have no clue what it is about:
Can anybody help?
Kind regards
Uwe
com.ibm.as400.system.PaseInternalError:
2com.ibm.as400.system.PaseInternalError: 2
at java/lang/Throwable.<init>(Throwable.java:194)
at java/lang/Error.<init>(Error.java:49)
at java/lang/VirtualMachineError.<init>(VirtualMachineError.java:35)
at java/lang/InternalError.<init>(InternalError.java:34)
at sun/awt/font/StandardGlyphVector.<init>(StandardGlyphVector.java:174)
at sun/awt/font/ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:219)
at sun/awt/font/ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:211)
at sun/awt/font/ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:484)
at sun/awt/font/ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:412)
at sun/awt/font/ExtendedTextSourceLabel.getLineBreakIndex(ExtendedTextSourceLabel.java:359)
at java/awt/font/TextMeasurer.calcLineBreak(TextMeasurer.java:290)
at java/awt/font/TextMeasurer.getLineBreakIndex(TextMeasurer.java:548)
at java/awt/font/LineBreakMea...
Date format problem with Java and MS-AccessHi,
I'm using access as database for my Java applications.I have specified
the Date format in Access as d/m/yyyy.
But when I retrieve the data from the database, I get for some dates
as m/d/yyyy format(for dates 1-10 specially).
I have even formatted my dates using SimpleDateFormat in my jsp files
as d/m/yyyy, but I'm still not able to get the dates in the correct
format.
Please help.
ruds wrote:
> Hi,
> I'm using access as database for my Java applications.I have specified
> the Date format in Access as d/m/yyyy.
> But when I retrieve the data from the database, I ge...
Windows utilities for Iseries As400 (OPEN SOURCE)
Get collection of windows for Iseries As400
Best Regard
Send me feed back
Link to GET windows utilities
http://nuke.risorsesoftware.it/LinkClick.aspx?fileticket=BeSF2H7xZoY%3d&tabid=82&mid=433
All windows have source code for translate in your language
Is free software ....
Utilities for all ....
Check Date
Check Password
Send Message
Build Menu
Build Choise
Send request
Ecc.ecc
...
Date Functions in SQL for DB2 / AS400 / iSeriesHi, I'm kinda new to AS400, having been lounging in SQL Server land
for years. I'm writing SQL queries to generate data for a web app. How
does one perform date difference 'arithmetic' against date columns?
For example
SELECT CURDATE() - "30 Days"?
Any tips would be greatly appreciated.
On 2 Apr., 06:22, "travo" <t...@prozacblues.com> wrote:
> Hi, I'm kinda new to AS400, having been lounging in SQL Server land
> for years. I'm writing SQL queries to generate data for a web app. How
> does one perform date difference 'arithmetic' against date columns?
>
> For example
> SELECT CURDATE() - "30 Days"?
>
> Any tips would be greatly appreciated.
Hi,
just remove the double qoutes!
Select Current_Date - 30 Days
>From SysIBM/SysDummy1
Birgitta
> just remove the double qoutes!
> Select Current_Date - 30 Days
>
Thanks Birgitta, the quotes were just to surround the plain language
phrase that I had in place, sorry for the confusion - I did try your
technique though - just to be sure - and unfortunately I had no luck.
I did have more luck working with the JULIAN_DAY() function - it
allowed me to perform some day-based arithmetic on the columns I was
working with.
I'm still open for suggestions, but for now I've got things working.
Cheers,
Travis
> > just remove the double qoutes!
> > Select Current_Date - 30 Days
> >
>
> Thanks Birgitta, ...
Why so many methods deprecated in java.util.Date.eg.
/**
* Returns the day of the month represented by this <tt>Date</tt>
object.
* The value returned is between <code>1</code> and <code>31</code>
* representing the day of the month that contains or begins with
the
* instant in time represented by this <tt>Date</tt> object, as
* interpreted in the local time zone.
*
* @return the day of the month represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
* replaced by <code>Calendar.get(Calendar.DAY_...
java.util.concurrent (JDK 1.5) problemSomeone knows what's wrong with this code? When I run it, sometimes all
threads finishes, sometimes not. Why?
When all is OK I get the following output:
Main thread enters sleep...
pool-1-thread-1 enters await...
pool-1-thread-4 enters await...
pool-1-thread-5 enters await...
pool-1-thread-3 enters await...
pool-1-thread-2 enters await...
Main thread woke up from sleep
Signalling all...
pool-1-thread-1 woke up from await
pool-1-thread-1 releases the lock
pool-1-thread-4 woke up from await
pool-1-thread-4 releases the lock
pool-1-thread-5 woke up from await
pool-1-thread-5 releases the lo...
Does java.util.Date.clone() return a new object?Hi,
I'm using Java 1.5. If I have
java.util.Date newDate = (java.util.Date) origDate.clone();
newDate.setYear(50);
Will the value of origDate.getYear() be 1950? That is, did clone make
a new object or just return a reference?
Thanks, - Dave
On 15 Pa=C5=BA, 16:11, laredotornado <laredotorn...@zipmail.com> wrote:
> Hi,
>
> I'm using Java 1.5. =C2=A0If I have
>
> java.util.Date newDate =3D (java.util.Date) origDate.clone();
> newDate.setYear(50);
>
> Will the value of origDate.getYear() be 1950? =C2=A0That is, did clone ma=
ke
> a new object or just...
IBM iSeries Client Access OLE DB problemsI am working on a project where I need to connect some Windows 2000
(SP3) servers to an IBM AS/400 database. I'm using IBM's Client Access
OLE DB driver (V5R2 with SI08894 patch installed) on each server. The
first serve is dual-processor, running SQL Server 2000 (SP3), and I
have a DTS package that is intended to copy data from the AS/400 to
some SQL Server tables. Problems:
1. When setting up the connection in the DTS package, saving the
AS/400 connection password with the package is problematic. The Blank
Password checkbox in the connection properties won't stay unchecked,
and if I type in a password, sometimes when I close the connection
properties it is saved and sometimes it is not. Of course, if it is
not, then the DTS package fails when it is scheduled to run
automatically.
2. When I do get a DTS package to execute, it seems that IBM's OLE
driver only allows a single connection to the AS/400. I say this
because only one data transformation task will run at a time. Using a
previous AS/400 OLE driver, I would see at least two data
transfformation tasks operating in parallel. I have installed the
registry key that IBM says is needed to enable connection pooling in
V5R2, but don't know of any tools that let me see what is really going
on with OLE connections. Is there some magic registry entry (or file
to edit) that sets the maximum number of connections? I know this is
supposed to be automatic, but it appears that only one connection is
being open...
IBM.Data.DB2.iSeries database access problemWhen I run the following vb.net code, I'm not able to acces the my database
AMFLIB.
I use to be able to access AMFLIB with the old ODBC driver from IBM iSeries
Access but now I want to use the new managed IBM.Data.DB2.iSeries data
provider from iSeries Access V5R3.
When I remove Database=AMFLIB from the connection string, I can connect but
as soon as I try to specify a known database (like my good old AMFLIB) I get
the following error:
IBM.Data.DB2.iSeries.iDB2ConnectionFailedException
"The connection cannot be opened because an error ocurred."
I'm runn...
Newer IBM MOUSE.SYS has problems with serial miceWhile installing eCS 1.2 just yesterday (21 Feb), I found an odd
problem with my serial mouse. Basically, everything worked fine
except the buttons. These were ignored when using the Desktop or
a subsidiary window. Opening a full screen VDOS, Win-3.1 or OS/2
window cured the bug.
Mensys in *.nl agreed this was weird but said they'd heard of it
before: IBM made a cods-up of the newer MOUSE.SYS and broke the
support for serial mice; it seems too many people have gone over
to PS/2 mice and their testing has gone lame. (IBM keep control
of the source code, one learns, so only an idiot could blame this
on the eCS folks.) The best fix Mensys can offer, lacking a rush
of code-fixing keenness by IBM, is to see something gets done for
the next installer refresh, to install the appropriate version of
MOUSE.SYS.
The fix in my case was to copy the MOUSE.SYS from
CD:\ECS\BOOT
to
OS:\OS2\BOOT
then reboot. All is happy now.
I must say eCS, at version 1.2, is starting to leave Warp 4.52 in
the dust with its general improvements. (Many are non-obvious.)
And the new installer continues to be a great help.
--
Andrew Stephenson
Andrew Stephenson schrieb:
>
> While installing eCS 1.2 just yesterday (21 Feb), I found an odd
> problem with my serial mouse. Basically, everything worked fine
> except the buttons. These were ignored when using the Desktop or
> a subsidiary window. Opening a full screen VDOS, Win-3.1 or OS/2
> window cured the bug.
> ...
IBM.Data.DB2.iSeries database access problemWhen I run the following vb.net code, I'm not able to acces the my
database AMFLIB.
I use to be able to access AMFLIB with the old ODBC driver from IBM
iSeries Access but now I want to use the new managed
IBM.Data.DB2.iSeries data provider from iSeries Access V5R3.
When I remove Database=AMFLIB from the connection string, I can connect
but as soon as I try to specify a known database (like my good old
AMFLIB) I get the following error:
IBM.Data.DB2.iSeries.iDB2ConnectionFailedException
"The connection cannot be opened because an error ocurred."
I'm running IBM iSeries Access V5R3 and my server is V5R2.
When I don't specify a database, after the connection is open the
database property is set to AS400REM. I don't know if this database is
a real database specific to my company.
******************************************
Imports IBM.Data.DB2.iSeries
Dim cn As New iDB2Connection
Try
TestConnection.ConnectionString = _
"DataSource=AS400;UserID=xxxx;Password=xxxx;Database=AMFLIB"
TestConnection.Open()
If TestConnection.State = ConnectionState.Open Then
MsgBox("Database: " & TestConnection.Database)
TestConnection.Close()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
******************************************
Thanks to all
Running higher version of ISERIES Access than the OS is probably not a
good idea.
Yanik Reid wrote:
> When I run the following vb.net code, I'm not able ...
zlib Deflate to java.util.zip inflate problemHello, I'm a total ruby newbie and am developing a simple app that
tests an existing web app. Part of the request I need to post
contains data that needs to be compressed as the web app will
uncompress it. Currently, the java app just uses simple
java.util.zip.Inflater to do this, and I've been able to do this from
cocoa to java no problem. Using Ruby to craft the data and post
request has presented a problem: when the web app gets the request,
I'm getting exceptions from java.utl.zip Unkown Compression format I
can't change the back end, only the ruby client s...
claculating the number of years from two java.Util datesI have two java.util dates with me i want calculate the number of years
between them .
Example:
Date1:19/02/2006
Date2:19/02/2007
If i give these two dates i should get the number ofyears as 1.
thanks in advance
manzur napisał(a):
> I have two java.util dates with me i want calculate the number of years
> between them .
>
> Example:
>
> Date1:19/02/2006
> Date2:19/02/2007
>
> If i give these two dates i should get the number ofyears as 1.
>
It depends what do you want.
What if ?:
Date1=19/12/2006,
Date2=19/02/2007
It should give 1 year or 0 year?
If...