Home » Infrastructure » Linux » no more data to read from socket error
no more data to read from socket error [message #652959] Thu, 23 June 2016 02:50 Go to next message
rdangelojp7
Messages: 5
Registered: June 2016
Junior Member
Hello there, this is my first post on this forum.
I have recently installed the following on my laptop: Ubuntu 14.04 (64 bit), Java 1.7, oracle 10g-xe, Eclipse Indigo Service Release 2, and Tomcat 6.0.45. I ran one of my java/jsp apps which initially does a simple 'select' query to the database (based on data inputted from a webpage), but so far every time I run the app I get 'SQLException: No more data to read from socket' or 'SQLRecoverableException: No more data to read from socket'. To connect to the database, I start the listener with '$ lsnrctl start', then the database with 'SQL> startup'. Then I start Tomcat and access my application through a browser. I tried connecting with all of the following jdbc packages (one at a time): classes12.jar, ojdbc6.jar, ojdbc7.jar, ojdbc14.jar (which came with 10g-xe). I've also tried (SERVER = DEDICATED) -> (SERVER = SHARED)
Here are some details of the process:

$ lsnrctl start
	LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JUN-2016 13:48:34
	Copyright (c) 1991, 2005, Oracle.  All rights reserved.
	Starting /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr: please wait...
	TNSLSNR for Linux: Version 10.2.0.1.0 - Production
	System parameter file is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
	Log messages written to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
	Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
	Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=1521)))
	Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
	STATUS of the LISTENER
	------------------------
	Alias                     LISTENER
	Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
	Start Date                23-JUN-2016 13:48:34
	Uptime                    0 days 0 hr. 0 min. 0 sec
	Trace Level               off
	Security                  ON: Local OS Authentication
	SNMP                      OFF
	Default Service           XE
	Listener Parameter File   /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
	Listener Log File         /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
	Listening Endpoints Summary...
	  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
	  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=1521)))
	Services Summary...
	Service "PLSExtProc" has 1 instance(s).
	  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
	The command completed successfully

SQL> startup
	ORACLE instance started.
	Total System Global Area  805306368 bytes
	Fixed Size		    1261444 bytes
	Variable Size		  209715324 bytes
	Database Buffers	  591396864 bytes
	Redo Buffers		    2932736 bytes
	Database mounted.
	Database opened.

EmpDisp.java, code to connect to database (also changed a little):
	OracleDataSource ods = new OracleDataSource();
	ods.setURL("jdbc:oracle:thin:@127.0.0.1:1521:PLSExtProc");
	ods.setUser("sys");
	ods.setPassword("xxxxx");
	con = ods.getConnection();	<---- this is line 34 where error happens

classes12.jar error trace:
	java.sql.SQLException: No more data to read from socket
		at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
		at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
		at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:857)
		at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:731)
		at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:690)
		at oracle.jdbc.ttc7.TTIpro.receive(TTIpro.java:139)
		at oracle.jdbc.ttc7.v8TTIpro.receive(v8TTIpro.java:97)
		at oracle.jdbc.ttc7.TTC7Protocol.connect(TTC7Protocol.java:1228)
		at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:209)
		at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:249)
		at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
		at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
		at java.sql.DriverManager.getConnection(DriverManager.java:571)
		at java.sql.DriverManager.getConnection(DriverManager.java:215)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:111)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:90)
		at p1.EmpDisp.getCon(EmpDisp.java:34)
		at p1.EmpDisp.doPost(EmpDisp.java:59)
		at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
		at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
		at filters.FilterTest2.doFilter(FilterTest2.java:50)
		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
		at filters.FilterTest.doFilter(FilterTest.java:100)
		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
		at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
		at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
		at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
		at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
		at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
		at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
		at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
		at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612)
		at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
		at java.lang.Thread.run(Thread.java:745)

ojdbc14.jar error trace:
	java.sql.SQLException: No more data to read from socket
		at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
		at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
		at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
		at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1118)
		at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
		at oracle.jdbc.driver.T4C8TTIpro.receive(T4C8TTIpro.java:131)
		at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:867)
		at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
		at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
		at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
		at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
		at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
		at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:297)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:221)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)
		at p1.EmpDisp.getCon(EmpDisp.java:34)
							.
							.
							.
					same as classes12.jar
							.
							.
							.
		at java.lang.Thread.run(Thread.java:745)

ojdbc6.jar error trace:
	java.sql.SQLRecoverableException: No more data to read from socket
		at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1157)
		at oracle.jdbc.driver.T4C8TTIpro.receive(T4C8TTIpro.java:129)
		at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1162)
		at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340)
		at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
		at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
		at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
		at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
		at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
		at p1.EmpDisp.getCon(EmpDisp.java:34)
							.
							.
							.
					same as classes12.jar
							.
							.
							.
		at java.lang.Thread.run(Thread.java:745)

ojdbc7.jar error trace:
	java.sql.SQLRecoverableException: No more data to read from socket
		at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:453)
		at oracle.jdbc.driver.T4C8TTIpro.receive(T4C8TTIpro.java:127)
		at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1389)
		at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
		at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)
		at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
		at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
		at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
		at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:303)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:230)
		at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:175)
		at p1.EmpDisp.getCon(EmpDisp.java:34)
							.
							.
							.
					same as classes12.jar
							.
							.
							.
		at java.lang.Thread.run(Thread.java:745)

part of listener.log:
	TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
	23-JUN-2016 13:54:26 *   (CONNECT_DATA=(CID=(PROGRAM=)(HOST=ricardo-Satellite-L305)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=1698 69568)) * status * 0
	23-JUN-2016 13:54:29 * (CONNECT_DATA=(SERVER=SHARED)(SERVICE_NAME=XE)(CID=(PROGRAM=sqlplus)(HOST=ricardo-Satellite-L305)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=43294)) * establish * XE * 12514
	TNS-12514: TNS:listener does not currently know of service requested in connect descriptor

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/log/PLSExtProc_agt_7982.trc:
	Oracle Corporation --- TUESDAY   JUN 21 2016 13:04:41.629
	Heterogeneous Agent Release 
	10.2.0.1.0 
	HS Agent diagnosed error on initial communication,
	   probable cause is an error in network administration
	   Network error 2:  NCR-00002: NCR: Invalid usage

There were no trace files at /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/trace/

Help!
Re: no more data to read from socket error [message #652964 is a reply to message #652959] Thu, 23 June 2016 03:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

You cannot use PLSExtProc service, it is a special one. Use XE service name.

If your database is up and running, it should have registered itself to the listener and "lsnrctl services" should show XE service.

Re: no more data to read from socket error [message #652969 is a reply to message #652964] Thu, 23 June 2016 03:38 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
Well spotted Michel!
The dbURL should be "jdbc:oracle:thin:@//127.0.0.1:1521/XE"
and not "jdbc:oracle:thin:@127.0.0.1:1521:PLSExtProc"

[Fixed typo - sorry!]
Re: no more data to read from socket error [message #653024 is a reply to message #652969] Fri, 24 June 2016 01:35 Go to previous messageGo to next message
rdangelojp7
Messages: 5
Registered: June 2016
Junior Member
Hello Michel and Frank, thanks for the responses.
This time I started the database first, then I ran lsnrctl services, lsnrctl start, then lsnrctl services again, with the following output:

$ lsnrctl services
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-JUN-2016 14:46:50
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ricardo-Satellite-L305)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-JUN-2016 14:47:27
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Starting /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Log messages written to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                24-JUN-2016 14:47:27
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File         /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

$ lsnrctl services
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-JUN-2016 14:47:56
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
The command completed successfully


Next, I went ahead and changed the dbURL to jdbc:oracle:thin:@//127.0.0.1:1521:XE, but got the following stack trace:
java.sql.SQLRecoverableException: IO Error: Invalid number format for port number
	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489)
	at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
	at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
	at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
	at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
	at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
	at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
	at p1.EmpDisp.getCon(EmpDisp.java:34)
	at p1.EmpDisp.doPost(EmpDisp.java:59)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at filters.FilterTest2.doFilter(FilterTest2.java:50)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at filters.FilterTest.doFilter(FilterTest.java:100)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
	at java.lang.Thread.run(Thread.java:745)
Caused by: oracle.net.ns.NetException: Invalid number format for port number
	at oracle.net.resolver.HostnameNamingAdapter.resolve(HostnameNamingAdapter.java:187)
	at oracle.net.resolver.NameResolver.resolveName(NameResolver.java:133)
	at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:431)
	at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:693)
	at oracle.net.ns.NSProtocol.connect(NSProtocol.java:251)
	at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140)
	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340)
	... 29 more



Here's my listener.ora:
# listener.ora Network Configuration File:
SID_LIST_LISTENER = (SID_LIST = (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
      (PROGRAM = extproc) ) )
LISTENER =
  (DESCRIPTION_LIST = (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx)(PORT = 1521)) ) )
DEFAULT_SERVICE_LISTENER = (XE)

Here's my tnsnames.ora:
# tnsnames.ora Network Configuration File:
XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx)(PORT = 1521))
    (CONNECT_DATA = (SERVER = SHARED) (SERVICE_NAME = XE) ) )
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) )
    (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )


I'll go ahead and research more on registering the database with the listener

[Updated on: Fri, 24 June 2016 01:38]

Report message to a moderator

Re: no more data to read from socket error [message #653026 is a reply to message #653024] Fri, 24 June 2016 02:05 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Do not use 127.0.0.1 use your host name: (HOST = xxxxx)
Start the listener BEFORE the database.
Given the listener.ora you gave, the url should be:
jdbc:oracle:thin:@//xxxxx:1521/XE

Before trying to connect verify the XE service is active using "lsnrctl services".

Re: no more data to read from socket error [message #653069 is a reply to message #653026] Sat, 25 June 2016 19:09 Go to previous messageGo to next message
rdangelojp7
Messages: 5
Registered: June 2016
Junior Member
OK, I started the listener before the DB, and checked the services with $ lsnrctl services, with this output:

$ lsnrctl services
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-JUN-2016 21:06:46
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ricardo-Satellite-L305, pid: 3863>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=46594))
Service "XE_XPT" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

Two things I noticed is the PLSExtProc service's status as unknown, and three of the services have "DEDICATED"

Unfortunatelly, even with jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE, using both
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection ("jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE", "sys", "xxxxx");
and
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE");
ods.setUser("sys");
ods.setPassword("xxxxx");
con = ods.getConnection();
I get the following results:
for ojdbc6.jar, ojdbc7.jar, and ojdbc14.jar:
ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory
for classes12.jar:
Io exception: Invalid connection string format, a valid format is: "host:port:sid"

Are you sure jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE is the right format?
how do you write the java code to connect (is it different from the above)?


Well, as I look into this more and more, one possibility that I found is that there is a bug either in the jdbc's or in Oracle. Seems like Oracle has already issued patches for this problem, but not for the express editions, and I think you have to buy a license for them to issue the patch.
thanks again
Re: no more data to read from socket error [message #653070 is a reply to message #653069] Sat, 25 June 2016 20:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

As I said, do NOT use SYS.
SYS is special, anything you do with SYS can prove or not prove what will happen with another account.

The error "ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory" proves that the database is not started. Start it before trying to connect to it.

Quoting http://docs.oracle.com/cd/B19306_01/appdev.102/b14302/ch_websrvtier.htm#CHDIACDC:
Quote:
Ensure that the following items are in your CLASSPATH environment variable:
Oracle JDBC drivers:
<ORACLE_HOME>/jdbc/lib/ojdbc14.jar (preferred)
<ORACLE_HOME>/jdbc/lib/classes12.jar (deprecated)

I think classes12 does not understand the service syntax (that is with "/") only the SID one (that is with ":"). In your case both have the same name but the correct way to name it in this version and upper is to use the service name (as for ojdbc14.jar.

[Updated on: Sat, 25 June 2016 20:26]

Report message to a moderator

Re: no more data to read from socket error [message #653071 is a reply to message #653070] Sun, 26 June 2016 00:10 Go to previous messageGo to next message
rdangelojp7
Messages: 5
Registered: June 2016
Junior Member
ok, here's the entire database startup process:
ricardo@ricardo-Satellite-L305:~$ sudo su --login oracle
[sudo] password for ricardo:

oracle@ricardo-Satellite-L305:~$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-JUN-2016 12:42:53
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Starting /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Log messages written to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                26-JUN-2016 12:42:54
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File         /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

oracle@ricardo-Satellite-L305:~$ gqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jun 26 12:43:06 2016
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
Warning: couldn't query or parse ALL_TABLES or ALL_VIEWS. Tablename completion disabled.

SQL> startup
ORACLE instance started.
Total System Global Area  805306368 bytes
Fixed Size		    1261444 bytes
Variable Size		  209715324 bytes
Database Buffers	  591396864 bytes
Redo Buffers		    2932736 bytes
Database mounted.
Database opened.
SQL>

here are the connection codes:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection ("jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE", "ricardo", "xxxxx");
and
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE");
ods.setUser("ricardo");
ods.setPassword("xxxxx");
con = ods.getConnection();

and here are my environment variables (in .profile and bash.bashrc):
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-oracle/bin:/u sr/lib/jvm/java-7-oracle/db/bin:/usr/lib/jvm/java-7-oracle/jre/bin:/home/ricardo/apache-ant-1.9.7/bin:/home/ricardo/apache-tomcat-6.0 .45/bin:/home:/home/ricardo:/home/ricardo/Documents/c++:/home/ricardo/Documents/javas:/usr/lib/oracle/xe/app/oracle/product/10.2.0/se rver/bin
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib
export CLASSPATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc14.jar
export ORACLE_SID=XE
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export CATALINA_HOME=/home/ricardo/apache-tomcat-6.0.45
export ANT_HOME=/home/ricardo/apache-ant-1.9.7

This time I only used ojdbc14.jar, but the same error message came out:
ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory

Do you know if anybody has been able to connect to any oracle xe throught a java servlet/jdbc on ubuntu?
Re: no more data to read from socket error [message #653072 is a reply to message #653071] Sun, 26 June 2016 01:33 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

1/ Try with SQL*Plus with normal local connection "conn ricardo/xxxxx"; if it works
2/ Add "NAMES.DIRECTORY_PATH= (EZCONNECT,TNSNAMES)" to sqlnet.ora file in $ORACLE_HOME/network/admin directory and try "conn ricardo/xxxxx@XE"; if it works
3/ Try "conn ricardo/xxxxx@//ricardo-Satellite-L305:1521:XE"; if it works else go to 5
4/ Try "conn ricardo/xxxxx@//ricardo-Satellite-L305:1521/XE"; if it works
5/ Try one of the above url which is working using OCI driver in your program: ods.setURL("jdbc:oracle:oci8:@//ricardo-Satellite-L305:152:XE"); or with "/"; if it works
6/ Retry the same thing with "thin" driver

If 1, 2, 3 and/or 4, and 5 work and not 6, I fail to see what is the problem.

[Updated on: Sun, 26 June 2016 02:31]

Report message to a moderator

Re: no more data to read from socket error [message #653073 is a reply to message #653069] Sun, 26 June 2016 07:12 Go to previous messageGo to next message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
rdangelojp7 wrote on Sat, 25 June 2016 19:09
OK, I started the listener before the DB, and checked the services with $ lsnrctl services, with this output:

$ lsnrctl services
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-JUN-2016 21:06:46
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ricardo-Satellite-L305, pid: 3863>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ricardo-Satellite-L305)(PORT=46594))
Service "XE_XPT" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

Two things I noticed is the PLSExtProc service's status as unknown, and three of the services have "DEDICATED"


The 'unknown' simply means the listener came to know of this sid from the SID_LIST section of listener.ora. It is "unknown" because the listener is simply trusting the SID_LIST entry but has not (and will not) verify its validity. Assuming the pieces are in place (and if everything is default, they will be) when the database starts up it will register itself with the listener. That's why it's better to start the listener first, but in the end it really doesn't matter because the database will continue to re-register itself every minute. If you start the database first there obviously won't be a listener with which to register, but it will keep trying. Then when you start the listener, it will take up to a minute before the database cycles around and registers. That's why when you first started the listener it reported 'no services'. You just needed to wait a minute. This is called 'dynamic regtistration, and when it happens, it will show in the listener status as 'READY'.

I like the analogy of a hotel desk clerk. When the clerk (listener) comes on duty, the manager provides him with a list "orders of the day" (listener) which includes a list of guests (SID_LIST section of listener.ora). The clerk has no way of knowing the accuracy of that guest list, but if a request comes in for someone on the list, he will try to deliver the message. Now, a guest can walk up to the desk and say "I'm Fred. If anyone asks for me, I'll be in the bar". Now the clerk knows for sure about Fred. That's dynamic registration.



The listener really does not require a listener.ora file at all. Without it, the listener will start with all default values. In 99% of all use cases, that is sufficient. And I'd say that in 100% of all XE installations that is sufficient.

[Updated on: Sun, 26 June 2016 13:31]

Report message to a moderator

Re: no more data to read from socket error [message #653080 is a reply to message #653073] Mon, 27 June 2016 06:21 Go to previous message
rdangelojp7
Messages: 5
Registered: June 2016
Junior Member
Thank you for the reply Ed, I'll keep that in mind from now on.

Michel, it WORKED!!!! you're a f*****g GENIUS!!!
First I moved the sqlnet.ora file from $ORACLE_HOME/network/admin/samples to $ORACLE_HOME/network/admin (it didn't have it at first) and added "NAMES.DIRECTORY_PATH= (EZCONNECT,TNSNAMES)" to it (that became the only uncommented line). Then I started the database like on my previous post, except I used 'sqlplus' instead of 'gqlplus'. My connection code is also the same as my previous post:
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//ricardo-Satellite-L305:1521/XE");
ods.setUser("ricardo");
ods.setPassword("xxxxx");
con = ods.getConnection();
and BOOM!!! I can execute queries through my web applications!!!

I've been going at this problem for about a month now, first it was with oracle 11g xe, and I turned the web upside down and backwards to find a solution, including posting on another forum. Finally I gave that up and installed 10g, only to see that f*****g error message again. You have no idea how grateful I am !!! if I'm ever in France I'll definitely buy you a beer!!!

[Updated on: Mon, 27 June 2016 06:27]

Report message to a moderator

Previous Topic: Oracle temp_space_header: parameter not set
Next Topic: Which files do I need to burn on DVD for installation on bare machine?
Goto Forum:
  


Current Time: Wed Dec 11 16:28:50 CST 2024