943,718 Members | Top Members by Rank

Ad:
  • Oracle Discussion Thread
  • Marked Solved
  • Views: 4913
  • Oracle RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Jul 29th, 2009
-1

Re: jdk1.6.0_14 and OracleXE connection problem

Ouch, looks like I messed up big time without spotting my own mistake
Java Syntax (Toggle Plain Text)
  1. import java.sql.*;
  2.  
  3. public class OracleConnect {
  4. public static void main(String[] args) throws SQLException {
  5. try {
  6. Class.forName("oracle.jdbc.OracleDriver");
  7. Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "username", "password");
  8. if (conn != null) {
  9. System.out.println("I am Connected to oracle database");
  10. }
  11. conn.close();
  12. }
  13. catch (Exception e) {
  14. System.out.println("ERROR : " + e);
  15. e.printStackTrace(System.out);
  16. }
  17. }
  18. }
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Jul 29th, 2009
0

Re: jdk1.6.0_14 and OracleXE connection problem

@ sos and Peter_budo ,what should i do now??
plzz somebody help me in this.

plzz post ur answers.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hims4u is offline Offline
23 posts
since Jul 2009
Jul 29th, 2009
0

Re: jdk1.6.0_14 and OracleXE connection problem

when i typed the two commands on cmd prompt, i got these errors:
it successfully got compiled but did run and gave the following errors!!!!

E:\test>javac -cp ojdbc14.jar OracleConnect.java
E:\test>java -cp .;ojdbc14.jar OracleConnect
ERROR : java.sql.SQLException: Io exception: Got minus one from a read call
java.sql.SQLException: Io exception: Got minus one from a read call
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.jav
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.jav
:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.jav
:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java
414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensi
n.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at jdbc1.main(jdbc1.java:12)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hims4u is offline Offline
23 posts
since Jul 2009
Jul 29th, 2009
0

Re: jdk1.6.0_14 and OracleXE connection problem

>it successfully got compiled but did run and gave the following
>errors!!!!

This is no longer a problem with your classpath setting which you were initially facing. Since it's an IOException, there might have been a lot of things going wrong here like the database not properly set to listen to connections etc. It would be kinda difficult to come up with a solution for us; do a web search for the given exception "Io exception: Got minus one from a read call" and check out the suggestions given there.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Oracle Forum Timeline: files of tables
Next Thread in Oracle Forum Timeline: vista DSN name oracle odbc driver missing





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC