Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- From: Joe Weinstein <joeNOSPAM@xxxxxxx>
- Date: Thu, 29 Dec 2005 08:09:24 -0800
mdwoolley wrote:
Hi
I am struggling to access rows in a table which contains a TIMESTAMP column. I get "ORA-03115: unsupported network datatype or representation" when executing a select statement. I am trying to isolate the problem by testing against a very simple table and with a simple test application.
Hi. I suspect your problem is that you're using a very old version of the thin driver. Try downloading a new one from Oracle. Also, don't call getDate() to get the data unless you specifically want to lose the time portion of the data. GetTimeStamp() is the right call. HTH, Joe Weinstein at BEA Systems
Here's the table:
Name Null? Type ----------------------------------------- -------- ---------------------------- NOW TIMESTAMP(0)
Here's the test application:
import java.text.SimpleDateFormat; import java.util.*; import java.io.*; import java.sql.*; import oracle.sql.TIMESTAMP;
public class OracleDateTime {
public static void main(String args[]) throws Exception { System.out.println("OracleDateTime V1.06"); Connection conn = null; try { String driverClassname = "oracle.jdbc.driver.OracleDriver"; String jdbcURL = "jdbc:oracle:thin:@localhost:1521:GANDALF"; String username = "seleniumsms"; String password = "password"; Class.forName(driverClassname); conn = DriverManager.getConnection(jdbcURL, username, password); System.out.println("Got connection...."); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } String insert = "insert into test values(?)"; String select = "select * from test"; PreparedStatement psinsert = conn.prepareStatement(insert); System.out.println("About to set timestamp in prepared statement"); psinsert.setTimestamp(1, new Timestamp(System.currentTimeMillis())); System.out.println("Done"); PreparedStatement psselect = conn.prepareStatement(select); psinsert.executeUpdate(); conn.commit(); System.out.println("Inserted record"); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); System.out.println("About to execute SELECT"); ResultSet rs = psselect.executeQuery(); System.out.println("Done"); while (rs.next()) { System.out.println("About to get date/time"); java.sql.Date d = rs.getDate(1); System.out.println("Done"); System.out.println("Timestamp is : "+df.format(d)); } }
}
And here's the output:
OracleDateTime V1.06 Got connection.... About to set timestamp in prepared statement Done Inserted record About to execute SELECT Exception in thread "main" java.sql.SQLException: ORA-03115: unsupported network datatype or represe ntation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168) at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208) at oracle.jdbc.ttc7.v8Odscrarr.receive(v8Odscrarr.java:191) at oracle.jdbc.ttc7.TTC7Protocol.describe(TTC7Protocol.java:586) at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:647) at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363 ) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
at OracleDateTime.main(OracleDateTime.java:38)
And running the same SELECT from SQL*PLUS yields:
NOW --------------------------------------------------------------------------- 29-DEC-05 09.27.00
So in summary:
I can insert a record containing a valid TIMESTAMP, complete with hours, minutes and seconds. But as soon as I try to retrieve the record I get the ORA-03115.
I'm using the thin JDBC driver.
Hope someone can help
Thanks
.
- Follow-Ups:
- Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- From: mdwoolley
- Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- From: mdwoolley
- Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- References:
- Oracle 9 TIMESTAMP ORA-03115 on SELECT
- From: mdwoolley
- Oracle 9 TIMESTAMP ORA-03115 on SELECT
- Prev by Date: Free Non ODBC MS Access drivers
- Next by Date: i want to get a sample
- Previous by thread: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- Next by thread: Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- Index(es):
Relevant Pages
|
|