Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems with Oracle

6 views
Skip to first unread message

Mike Fontenot

unread,
Jun 13, 1998, 3:00:00 AM6/13/98
to

All,

I am trying to execute a simple java program (see code at bottom) against
Oracle 8 on NT. Any suggestions on when I execute I get the following
error:

java.sql.SQLException: No more data to read from socket
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:411)
at oracle.jdbc.ttc7.TTCInBuffer.getByte(TTCInBuffer.java:94)
at oracle.jdbc.ttc7.TTIMsg.unmarshalSB1(TTIMsg.java:1076)
at oracle.jdbc.ttc7.O3log.receive1st(O3log.java:503)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:163)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:93)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:147)
at java.sql.DriverManager.getConnection(DriverManager.java:91)
at java.sql.DriverManager.getConnection(DriverManager.java:134)
at JdbcTest.main(JdbcTest.java:15)
at symantec.tools.debug.MainThread.run(Agent.java:56)
Application terminated


Here is the program:

import java.sql.*;
import oracle.jdbc.driver.*;
import java.io.*;

class JdbcTest {
public static void main (String args []) throws SQLException {
// Load Oracle driver
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

// try{Class.forName ("oracle.jdbc.driver.OracleDriver");}
// catch (ClassNotFoundException e) {e.printStackTrace();}

// Connect to the local database
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:@laptop1:1521:orcl",
"scott", "tiger");

// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select ename from emp");

// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));

try
{
System.out.println("\nPress ENTER to quit this program");
System.in.read();
} catch(IOException e) {}
}
}

Johnny Wong

unread,
Jun 17, 1998, 3:00:00 AM6/17/98
to

I had a similar problem. It looks like for some databases (or drivers) there
is no random access to columns for a result set. That is, in order to read
the values of columns for a given row, you have to read them sequentially.

Another thing I observed (and I think this applies to your problem) is that,
again for some dbs or JDBC drivers, a column value can't be read more than
once. The second time you try reading something, the exception " No data
read" (or something like that) will appear.

Johnny Wong
Luna Information Systems

Joe Weinstein

unread,
Jun 18, 1998, 3:00:00 AM6/18/98
to Johnny Wong

Johnny Wong wrote:
>
> It looks like for some databases (or drivers) there
> is no random access to columns for a result set. That is,
> in order to read the values of columns for a given row,
> you have to read them sequentially.
>
> Another thing I observed (and I think this applies to your
> problem) is that, again for some dbs or JDBC drivers, a
> column value can't be read more than once. The second time
> you try reading something, the exception " No data read"
> (or something like that) will appear.
>

That's a very flakey JDBC driver. Is it freeware, or is someone
actually trying to sell it?

--

Joseph Weinstein Staff Engineer http://www.weblogic.com
WebLogic, Inc. 415-659-2621 j...@weblogic.com
See our newsgroups: http://www.weblogic.com/services/newsgroups.html

Johnny Wong

unread,
Jun 18, 1998, 3:00:00 AM6/18/98
to

>That's a very flakey JDBC driver. Is it freeware, or is someone
>actually trying to sell it?
>


I was using the jdbc-odbc bridge that comes with JDK 1.2 (beta) to access a
MS SQL Server 6.5 and get column info for a table.

Also, I remember reading in the JDBC design specs about the isNull() vs.
wasNull() controversy. wasNull() returns true if the value just read was
null. isNull() takes an column index argument (I believe) and tells whether
such column has a null value for the current row. The reason, JDBC designers
claim, that they threw out the isNull() call was because for some dbs the
only way to know whether some value is null is by reading it. Furthermore,
for some (or all) of those dbs they would only permit reading the value
once. Hence my answer.

Regarding the sequential access error for column values, I have no clue of
why that might be. Any ideas?

Johnny Wong
Luna Information Systems

Danno Ferrin

unread,
Jun 22, 1998, 3:00:00 AM6/22/98
to

Joe Weinstein wrote:
>
> Johnny Wong wrote:
> >
> > It looks like for some databases (or drivers) there
> > is no random access to columns for a result set. That is,
> > in order to read the values of columns for a given row,
> > you have to read them sequentially.
> >
> > Another thing I observed (and I think this applies to your
> > problem) is that, again for some dbs or JDBC drivers, a
> > column value can't be read more than once. The second time
> > you try reading something, the exception " No data read"
> > (or something like that) will appear.
> >
>
> That's a very flakey JDBC driver. Is it freeware, or is someone
> actually trying to sell it?
>

It's not a flakey JDBC Driver, it is conforming to the JDBC Spec. If
you read the spec it says that for maximum compatibility developers
should read the columns in order, only once. There are many performance
implications because of this (better driver performance, smaller code
size.) It also describes why wasNull() exists rater that isNull(int i),
and other things that appear strange.


here's a link:
http://java.sun.com/products/jdbc/jdbcsw2.html#1.2 Specification

0 new messages