In both cases i am hitting the same weblogic server which has got the dfferent Classpath for different drivers.No other changes in the environment.
Main Topics
Browse All TopicsHi All,
i am facing a problem with oracle 9.2.0.5 thin drivers.
we have got a third party software that was displaying the date in the following
format with oracle9.2.0.5 and 9.0.1.4 driver
2004-12-08 21:15:10
But when i changed the driver to 9.2.0.5 with oracle9.2.0.5 and 9.2.0.5 driver.
it is displaying the date in following format
11/15/2004 15:15:55
i don't have any access to the code for checking which way it is displaying date.
i have written one Java Client for investgating some point.
i am attaching the same here and output of that.but i am not able to conclude any thing Can somebody help me out.
import java.util.*;
import java.io.*;
import javax.sql.*;
import java.sql.*;
import javax.naming.Context;
import javax.naming.InitialContex
import javax.naming.NamingExcepti
import oracle.jdbc.OracleStatemen
import java.text.*;
public class DateTest
{
public static void main(String args[])
{
DateTest DT = new DateTest();
}
public DateTest()
{
try
{
System.out.println("######
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
private Connection getNormalConnection() {
Connection con = null;
try {
Class.forName("oracle.jdbc
con = DriverManager.getConnectio
"jdbc:oracle:thin:@172.26.
}
catch (Exception e) {
e.printStackTrace();
}
return con;
}
/**
* Gets the SLAM Database Connection
*
* @param Map connDetails
* @return Connection object for SLAM db
*/
private Connection getConnection(Map connDetails) {
Connection conn = null;
//could make a get connection method as we do this again in another
final Hashtable properties = new Hashtable();
try {
properties.put(Context.INI
weblogic.jndi.WLInitialCon
properties.put(Context.PRO
InitialContext ctx = new InitialContext(properties)
DataSource ds =
(javax.sql.DataSource) javax.rmi.PortableRemoteOb
ctx.lookup("JNDI_LAM"), javax.sql.DataSource.class
conn = ds.getConnection();
}
catch (Exception e) {
e.printStackTrace();
}
return conn;
}
private long getLastUpdatedTime(Map connDetails)
{
System.out.println("#####g
//DateFormat df = DateFormat.getDateInstance
String query = "select * FROM NLS_SESSION_PARAMETERS";
DateFormat df = DateFormat.getDateInstance
java.sql.Date updatedDate = null;
Time time = null;
Timestamp s = null;
Connection objConnection = null;
String updatedTimeQuery = null;
PreparedStatement psUpdatedTimeQuery = null;
ResultSet rsUpdatedTimeQuery = null;
ResultSetMetaData rsMetadata = null;
Statement stmt = null;
ResultSet rs = null;
//System.out.println("SRS-
//Normal one
Connection con = getNormalConnection();
Statement norstmt = null;
ResultSet norrs = null;
//NLS_SETTING
Statement nlsstmt = null;
ResultSet nlsrs = null;
ResultSetMetaData rsmd = null;
String update = null;
try
{
objConnection = getConnection(connDetails)
//updatedTimeQuery = "SELECT updatedDATE FROM Page";
updatedTimeQuery = "SELECT sysdate from dual";
stmt = objConnection.createStatem
ResultSet.CONCUR_READ_ONLY
//((OracleStatement)stmt).
//stmt.executeQuery("alter
//stmt.close();
stmt = objConnection.createStatem
ResultSet.CONCUR_READ_ONLY
System.out.println("Statem
rs = stmt.executeQuery(updatedT
System.out.println("Column
System.out.println("Result
psUpdatedTimeQuery = objConnection.prepareState
System.out.println("Statem
rsUpdatedTimeQuery = psUpdatedTimeQuery.execute
System.out.println("Column
System.out.println("Result
//rsMetadata = rsUpdatedTimeQuery.getMeta
//NLS
nlsstmt = objConnection.createStatem
nlsrs = nlsstmt.executeQuery(query
while (nlsrs.next())
{
System.out.println("NLS -->" + nlsrs.getString(1) +":::"+ nlsrs.getString(2));
}
if(rsUpdatedTimeQuery.next
{
s = rsUpdatedTimeQuery.getTime
updatedDate = rsUpdatedTimeQuery.getDate
update = rsUpdatedTimeQuery.getStri
time =rsUpdatedTimeQuery.getTim
//System.out.println("Form
}
if(rs.next())
{
System.out.println("Using Scrollable getString()" + rs.getString(1));
//System.out.println("Form
System.out.println("Using Scrollable date" + rs.getDate(1));
System.out.println("Using Scrollable time" + rs.getTime(1));
System.out.println("Using Scrollable timestamp" + rs.getTimestamp(1));
}
rsUpdatedTimeQuery.close()
psUpdatedTimeQuery.close()
objConnection.close();
///////Normal
//norstmt = con.createStatement(Result
norstmt = con.createStatement();
System.out.println("Statem
norrs = norstmt.executeQuery(updat
System.out.println("Column
System.out.println("Result
if(norrs.next())
{
System.out.println("Using NormalConn getString()" + norrs.getString(1));
//System.out.println("Form
System.out.println("Using NormalConn date" + norrs.getDate(1));
System.out.println("Using NormalConn time" + norrs.getTime(1));
System.out.println("Using NormalConn timestamp" + norrs.getTimestamp(1));
}
}
catch(SQLException ex){
ex.printStackTrace();
}
System.out.println("Using Normal getString() date--> "+update) ;
System.out.println("Using Normal TimeStamp "+s.toString());
System.out.println("Using Normal Time"+s.getTime());
System.out.println("Using Normal date"+updatedDate.toString
System.out.println("Using Normal time"+time.toString());
return s.getTime();
}
}
The output in am getting is like
#####getLastUpdatedTime###
Statement Scroll --> weblogic.jdbc.rmi.SerialSt
Column Scroll Class Name java.sql.Timestamp
Resultset Scroll --> weblogic.jdbc.rmi.SerialRe
Statement Noraml --> weblogic.jdbc.rmi.SerialPr
Column Class Name java.sql.Timestamp
Resultset Noraml --> weblogic.jdbc.rmi.SerialRe
NLS -->NLS_LANGUAGE:::ENGLISH
NLS -->NLS_TERRITORY:::UNITED KINGDOM
NLS -->NLS_CURRENCY:::?
NLS -->NLS_ISO_CURRENCY:::UNIT
NLS -->NLS_NUMERIC_CHARACTERS:
NLS -->NLS_CALENDAR:::GREGORIA
NLS -->NLS_DATE_FORMAT:::YYYY/
NLS -->NLS_DATE_LANGUAGE:::ENG
NLS -->NLS_SORT:::BINARY
NLS -->NLS_TIME_FORMAT:::HH24.
NLS -->NLS_TIMESTAMP_FORMAT:::
NLS -->NLS_TIME_TZ_FORMAT:::HH
NLS -->NLS_TIMESTAMP_TZ_FORMAT
NLS -->NLS_DUAL_CURRENCY:::?
NLS -->NLS_COMP:::BINARY
NLS -->NLS_LENGTH_SEMANTICS:::
NLS -->NLS_NCHAR_CONV_EXCP:::F
Using Scrollable getString()12/22/2004 10:18:5
Using Scrollable date2004-12-22
Using Scrollable time10:18:05
Using Scrollable timestamp2004-12-22 10:18:05.0
Statement Normal Conn --> oracle.jdbc.driver.OracleS
Column NormalConne Name java.sql.Timestamp
ResultSet Normal Conn --> oracle.jdbc.driver.OracleR
Using NormalConn getString()2004-12-22 10:18:07.0
Using NormalConn date2004-12-22
Using NormalConn time10:18:07
Using NormalConn timestamp2004-12-22 10:18:07.0
Using Normal getString() date--> 2004-12-22 10:18:06.0
Using Normal TimeStamp 2004-12-22 10:18:06.0
Using Normal Time1103710686000
Using Normal date2004-12-22
Using Normal time10:18:06
Can anybody help??
regards
manoj velliyatt
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Just run the following query in your JDBC and get the output .
select to_date(:1, 'YYYY-MM-DD') NewDate from dual;
Bind :1 to the date and capture NewDate in your ResultSet.
You can check out more about to_date :
http://www.adp-gmbh.ch/ora
or
http://www.techonthenet.co
This will definitely solve your problem.
I hope you are aware of how to call this query from JDBC and stuff like that..
While using the thin driver is that going to take effect?
i have seen some bug rasied for the same saying it is not taking effect.
I didn't try that option.
Is this happening due to some default implementation changes inside the driver?
Scrollable resultset is returning the same result on getString() call which thrid party component displaying with latest driver. Is it happeing such a way that the default normal statement is using scrollable internally with new 9.2.0.5 drivers?
All inputs are welcome.
Hi all,
thanks for the help.
The below link given the answer to my problem.I thought i will share it with all.
http://www.oracle.com/tech
oracle.jdbc.V8Compatible=t
thanks once again
Cheers
manoj velliyatt
Business Accounts
Answer for Membership
by: bloodredsunPosted on 2004-12-22 at 07:22:54ID: 12884432
Is it anything to do with the default locale of your new setup (I use sybase not oracle so I can't be too specific). Or how the dates are being processed internally.
Failing that you might be forced to formating dates with SimpleDateFormat.