| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: jdbc : No more data to read from socket
sudhin_at_saathi.ncst.ernet.in wrote:
> Hi
> I want to use a pure java driver for Oracle V8 ( and also V7.2 )
> I downloaded jdbcthin.zip
> and I get the message
>
> java.sql.SQLException: No more data to read from socket
>
> This is the source code I used
> // Load Oracle driver
> DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
> // Connect to the database
> Connection conn =
> DriverManager.getConnection ("jdbc:oracle:thin:@myhost:1521:orcl",
> "scott", "tiger");
>
> There were many such postings. But what is the answer ?
> thanks in advance
> -sudhin
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
First of all, the Oracle Thin driver is a TCP/IP driver. The Program needs a
port to talk directly
with the Net Listener from Oracle (Someone correct me, if i forgot
something). Then you need the fully qualified name of the
machine (if you are not in the same subnet), the DB-name (The Name of the
instance,
where your tables reside), the User and Password.
I used the driver for Oracle7.3, it is working, i think, the driver for
Oracle8 has had some problems.
I have an example of code, you have to adapt it to your needs.
import java.io.*;
import java.sql.*;
//...
//...
//... It uses Oracle Thin Driver
//... The Driver found in classes111.zip
//...
//...
try {
DriverManager.registerDriver (new
oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection
("jdbc:oracle:thin:@MASCHINE:PORT:DB","USER","PASSWORT");
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select * from TABELLE");
System.out.println(rset.toString());
textArea.append("Eingabe : " + textField.getText() + newline
);
// Loop through the results of the query
while (rset.next ())
{
String ename1 = rset.getString (1);
String ename2 = rset.getString (2);
System.out.println(ename1 + " - " + ename2);
textArea.append("Select : "+ ename1 + " - " + ename2 +
newline);
}
} catch (SQLException s1 )
{ System.out.println("Error (" + s1.getMessage() +")
aufgetreten"); }
//...
//...
regards,
--
Ronald Ali-Khan
khan_at_informatik.fh-hamburg.de
Hamburg, Germany
Received on Fri Dec 18 1998 - 07:32:58 CST
![]() |
![]() |