Oracle 9 TIMESTAMP ORA-03115 on SELECT
- From: "mdwoolley" <martin@xxxxxxxxxxxxxx>
- Date: 29 Dec 2005 01:40:24 -0800
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.
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: Joe Weinstein
- Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- Prev by Date: Re: download database from website?
- Next by Date: Free Non ODBC MS Access drivers
- Previous by thread: Re: ***CHALLENING OFFER FOR JAVA DEVELOPERS IN OUR INDIA******
- Next by thread: Re: Oracle 9 TIMESTAMP ORA-03115 on SELECT
- Index(es):
Relevant Pages
|
|