End of TNS data Channel error
I am running oracle 8i v 8.0.3.0.6 on Netware. When trying to connect to an existing TNS Name(which works with all other item) using the JDBC thin client I receive the 'End of TNS data Channel' error.
Can anyone give me some direction as to what I can do.
Thanks;
John
[email protected]
If you are using the oracle thin driver, make sure you get the latest driver
from oracle.
Firewall could be an issue here, so try to make sure you set the
TestConnsOnReserve to true in the connection pool props.
hth
sree
"sarathy" <[email protected]> wrote in message
news:3c30473f$[email protected]..
Hi,
We are using the Weblogic application server for our web-based applications.
We defined a connection pool in it, which creates 2 connections to an Oracle
database i.e initial capacity 2 and maximum capacity 4. But every one in a
while when requesting data, I get the following error : SQLException : End
of TNS data channel.I am not able to understand weather this is a networking
problem or database problem.If anyone has any idea please help,b'coz it is
very urgent.
Similar Messages
-
Getting "End of TNS Data Channel" Errors
Hi,
I am using Migration WorkBench to migrate data from SQL Server 2000 to Oracle 8.1.7. I always get the "End of TNS data channel" when I try to migrate tables and data.
The data repository (in Migration WorkBench) is also a Oracle 8.1.7 database.
It works fine if I only migrate the schema without the data. The source schema contains many tables with LOB type columns (BLOB or CLOB). I read in some other forums that there are issues between thin JDBC drivers and BLOB/CLOB column datatypes.
Is it possible to use Migration WorkBench with OCI drivers. Is there any way we can do this ?
Any other things that I can check in my set up ?
Thanks in advance.
Regards
MandarI am using version
9.2.0.1.2 (Production)
Build 20020910
Microsoft SQL Server 2000 Plug-In, Release 9.2.0.1.3 Production.
I cannot use the SQL Loader scripts as the source database contains many tables with BLOB or CLOB data and this is not supported by using SQL loader option.
Thanks
Mandar -
OC4J problem and End of TNS data channel
We are using Oralce 9iAS with OC4J to host our java application. Recently, we kept having problem with the application. The problem is when user enters username and password to login, the application doesn't do anything until we restart OC4J instance. After tracking down all the error log files, it looks like problem happened whenever the application get "SQL Exception: End of TNS data channel" error. I don't know why are we getting this "End of TNS data channel" error. I don't think it is the application's problem.
1)Does anybody have any idea why?
2)Does OC4J server need to be restarted every once a while.
Thanks in advance.Hi Liya -
"End of TNS data channel" is usually a message sent by the database when something erroneous is occuring.
What version of the database, JDBC, and JDK are you using?
Are you getting any dump files from the database?
Can you describe a little more about what the application code is doing?
There is some good information on this error message at the following URL
http://forum.java.sun.com/thread.jsp?thread=280338&forum=48&message=1090056
-steve- -
I still haven't seen a fix or a work around for the "End of TNS Data Channel" error.
(This is the problem trying to connect to a 7.3.x server using 8.x Thin JDBC drivers. For further details, search this forum for "End of TNS Data Channel" to read many related posts dating as far back as May 1999.Hi,
I had arrived very late to this forum and I don't know if now
there is a solution or workaround related with "End of TNS Data
Channel".
I'm trying to connect a HttpServlet with an Oracle 7.3.4 server
and I have the specific need to use JDBC 2.0 driver because I
must use it's table "scrolling" facilities, but allways I get
the same SQL Exception.
Please send me any suggestion about this topic to my email
account: [email protected]
Thank you very much in advance.
Jorge Ortiz -
[HELP] End of TNS data channel
[please CC: to me when you reply if possible]
i'm using
solaris 2.7, jdk 1.2.2, oracle 8i 8.1.6,
classes12.zip jdbc driver (the latest one for 8.1.6 that i downloaded a week ago)
when i recompiled & ran my used-to-be working code (with just newer jdbc driver & jdk), in run time, it kept giving me:
java.sql.SQLException: End of TNS datachannel
i'm positive that i'm using correct login/password/parameters for the oracle thin driver since the code was working fine.
any help would be appreciated.JDBC Development Team said:
"I've never seen this before. Can you post a stack trace? Also, do you have small (tiny) test case?"
Do a search in this forum for "End of TNS Data Channel" and you should see at least 4 threads on this topic. The posts date back to May 1999. Shame on you if you haven't seen it before. Oracle hasn't issued a fix.
Here's my version of it:
Server: Oracle 8.1.5.x on RedHat Linux 6.x
Client: JDK 1.2.1, JDBC Thin Drivers 8.1.5
Result: Works
Server: Oracle 7.3.4.x on Netware 4.x
Client: JDK 1.2.1, JDBC Thin Drivers 8.1.5
Result: Doesn't work
Server: Oracle 7.3.4.x on Netware 4.x
Client: JDK 1.2.1, JDBC Drivers 7.3.x
Result: Doesn't work
Server: Oracle 7.3.4.x on Netware 4.x
Client: JDK 1.2.1, JDBC Drivers 8.1.6.x
Result: Doesn't work
When it doesn;t work it gives an End of TNS Data Channel error followed by DBError.java:114, DBError.java:156, DBError.java:269, OracleConnection.java:210, and other errors.
null -
ERROR : End of TNS data channel
java.sql.SQLException: Io exception: End of TNS data channel
HI,
We have a websphere application and the backend is oracle 8.1.7 on NT.
We use JDBC for connectivity to Oracle.
We are coming across the above mentioned error for some of the transactions.
Also since no ORA- number is returned i'm unable to get to the cause of the error.
If anyone of u has come across a similar situation then pl let me know the cause of the error and the solution to it.
Thanks,
RaviElectroD,
Try using "LEFT OUTER JOIN" instead of LEFT JOIN alone. It might get through.
Thanks,
Ishan -
Io exception: End of TNS data channel when Indexing
I am trying to create an index on a column which contains rules to be used with CTXRULE. I would also like to improve the wildcard search, so that searching for
"depletes" would be matched up with the rule "%deplete%". I am also using a blank stopwords list as the rules are quite precise.
For that, I am creating the following preferences:
-- create new pref
exec Ctx_Ddl.Create_Preference('wildcard_pref', 'BASIC_WORDLIST');
-- allows better %abc%
exec ctx_ddl.set_attribute('wildcard_pref','SUBSTRING_INDEX', 'TRUE');
or
-- allows better abc%
exec ctx_ddl.set_attribute('wildcard_pref','prefix_index', 'YES');
exec ctx_ddl.set_attribute('wildcard_pref','PREFIX_MIN_LENGTH', 3);
exec ctx_ddl.set_attribute('wildcard_pref','PREFIX_MAX_LENGTH', 10);
-- drop existing stoplist pref
exec ctx_ddl.drop_stoplist('stoplist_pref');
-- create new stoplist pref
exec ctx_ddl.create_stoplist('stoplist_pref');
create index testrule_IDX on test_table(rules)
indextype is ctxsys.CTXRULE
parameters ('Wordlist wildcard_pref Stoplist stoplist_pref');
The above script works fine until it comes to creating the index, upon which I get the following error (line numbers different):
Error starting at line 11 in command:
create index testrule_IDX on test_table(rules)
indextype is ctxsys.CTXRULE
parameters ('Wordlist wildcard_pref Stoplist stoplist_pref')
Error at Command Line:11 Column:0
Error report:
SQL Error: Io exception: End of TNS data channel
However, if I don't include the additional attributes, the index gets created without any issues.
I am using Oracle 10.2.0.3 on UNIX, and running the code through SQL developer.
Any help would be greatly appreciated.
Thanks.According to the documentation wildcards and prefix and substring indexes are not supported with ctxrule. If you try to use these things, the index may not get created. If you are creating your index from SQL*Plus, you should get a specific error message telling you that or you might get more information from ctx_user_index_errors. If you try to use a wildcard in your rules, it seems to cause the whole query to return no rows. However, if you user a lexer with index_stems, it seems to return all words that have the same stem word as the search word in the rules. Please see the demonstration below with and without the index_stems.
SCOTT@orcl_11g> CREATE TABLE test_table
2 (rulesid NUMBER PRIMARY KEY,
3 category VARCHAR2(30),
4 rules VARCHAR2(30))
5 /
Table created.
SCOTT@orcl_11g> INSERT INTO test_table VALUES (1, 'cat1', 'charge')
2 /
1 row created.
SCOTT@orcl_11g> INSERT INTO test_table VALUES (2, 'cat2', 'deplete')
2 /
1 row created.
SCOTT@orcl_11g> create index testrule_IDX on test_table(rules)
2 indextype is ctxsys.CTXRULE
3 /
Index created.
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charge') > 0
2 /
RULESID CATEGORY RULES
1 cat1 charge
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charged') > 0
2 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charges') > 0
2 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charging') > 0
2 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'recharge') > 0
2 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'depletes') > 0
2 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'other') > 0
2 /
no rows selected
SCOTT@orcl_11g> drop index testrule_idx
2 /
Index dropped.
SCOTT@orcl_11g> BEGIN
2 ctx_ddl.create_preference('mo_lexer','BASIC_LEXER');
3 ctx_ddl.set_attribute('mo_lexer', 'INDEX_STEMS', 'ENGLISH');
4 END;
5 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> create index testrule_IDX on test_table(rules)
2 indextype is ctxsys.CTXRULE
3 parameters ('lexer mo_lexer')
4 /
Index created.
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charge') > 0
2 /
RULESID CATEGORY RULES
1 cat1 charge
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charged') > 0
2 /
RULESID CATEGORY RULES
1 cat1 charge
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charges') > 0
2 /
RULESID CATEGORY RULES
1 cat1 charge
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'charging') > 0
2 /
RULESID CATEGORY RULES
1 cat1 charge
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'recharge') > 0
2 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'depletes') > 0
2 /
RULESID CATEGORY RULES
2 cat2 deplete
SCOTT@orcl_11g> SELECT * FROM test_table WHERE MATCHES (rules, 'other') > 0
2 /
no rows selected
SCOTT@orcl_11g> spool off -
What does "End of TNS data channel" mean?
DB: Oracle 8
OS: WinNT
I am trying to add a new connection via the connection manager. I
have tested my connection to the DB using SQL NET and know that
TNS names are correct. However when I enter all details in the
connection manager and click "Test Connection" I get the
following error message.
"End of TNS data channel"
Anyone have any ideas,
Thanks,
Andy Shiels
nullJDeveloper Team (guest) wrote:
: Andy,
: When you create the connection in JDeveloper, what method are
you
: using? Did you choose Existing TNS Names or Named Host?
: If you are using Existing TNS Names, then the alias must use
the
: SID=sidname rather than the SERVICE NAME= specifier.
I have used all possible configurations using the sid, and
service name. I also succesfully used one of ODBC connections,
however the Connection 'wizard' wouldn't add it to its Connection
list.
: Specifically what version of the database you are connecting to
: and what OS it is running on may also be the source of the
: problem.
Server Windows NT Server NT v.4
Client Windows NT Workstation v.4 sp 4
Oracle Version 8.0.5. (purchased about 1 week ago)
If you are trying to connect to an 8.0.5 DB on LINUX,
: there is a patch you need to apply to the database so JDBC can
: connect to it. This is also true for some 8.0.3 versions.
: I would try editing your connection to use the Named Host
method
: and see if that works. JDeveloper uses JDBC to connect, so
: testing with SQL*Net is not always a sure-bet that the JDBC
: connection will work.
: L
: Andy Shiels (guest) wrote:
: : DB: Oracle 8
: : OS: WinNT
: : I am trying to add a new connection via the connection
manager.
: I
: : have tested my connection to the DB using SQL NET and know
that
: : TNS names are correct. However when I enter all details in
the
: : connection manager and click "Test Connection" I get the
: : following error message.
: : "End of TNS data channel"
: : Anyone have any ideas,
: : Thanks,
: : Andy Shiels
null -
Lo exception: End of TNS data channel
When connecting to EM DBControl, I receive error message: "lo exception: End of TNS data channel".
Any idea?Ok seems like tnsnames.ora had wrong info. I did change it so I can login to EM Console but it takes a minute on average to load any page further on. This machine is idling, nobody is connected right now.
-
XSQL : End of TNS data channel?
Hi, I'm having trouble using the Oracle xsql servlet for a mission-critical application. Using a complicated query which has several cursors, I get the following error:
oracle.xml.sql.OracleXMLSQLException: Io exception: End of TNS data channel
I have the servlet deployed to Apache Tomcat 3.2 (I have also tried 3.1, with the same results). This error seems to only occur when the query selects from certain tables. However, the same query works fine in SQL*Plus or any similar tool.
Any idea what might be causing this? If not, can you point me to someone who might have an idea?
This seems to be a recent problem. Some queries that worked before don't work anymore. Changes that have been made since then are that the database's Net8 service was removed and re-setup, and also that all the tables and indexes in the schema have been re-analyzed.Whenever a problem appears to be in the XSQL Servlet -- specifically those that relate to translating SQL statements into XML -- here's a tip to help diagnose the problem.
The XSQL action handler for the <xsql:query> action directly makes use of the Oracle XML SQL Utility to do the real work. The XSQL Pages system pools database connections and makes using the XSU easier because most common tasks can be done with templates, but when a problem arises in this area it is likely an issue with the underlying XML SQL Utility.
To help see whether this is in fact the case, try the same query that is causing problems using the XML SQL Utility's command line OracleXML utility.
$ OracleXML getXML -u username/password "SELECT ... "
If you are getting TNS errors, likely the server is generating server-side trace files that might provide additional details on what the issue might be. -
OracleXMLSQLException: Exception d'E/S: End of TNS data channel UpdateXML
Hi,
I am trying to UpdateXML a XMLDocument to an Database Table and I have the famous TNS data channel error !
here a part of my code :
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn =
DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:ORCL","user","password");
THIS CONNECTION IS OK and I have no exception with another part of code which is doing an OracleXMLQuery !!
OracleXMLSave save = new OracleXMLSave(conn, "ORCL.TABLETOUPDATE");
String [] keyColNames = new String[1];
keyColNames[0] = "ID_TABLETOUPDATE";
save.setKeyColumnList(keyColNames);
String[] updateColNames = new String[1];
updateColNames[0] = "MY_COLUMN_TO_UPDATE";
save.setUpdateColumnList(updateColNames);
save.updateXML(xmldoc); >> this make the TNS exception (see after)
save.close();
here is the exception:
System Error: oracle.xml.sql.OracleXMLSQLException: Exception d'E/S: End of TNS data channel
System Error: int oracle.xml.sql.dml.OracleXMLSave.saveXML(org.w3c.dom.Document, int) (OracleXMLSave.java:1928)
System Error: int oracle.xml.sql.dml.OracleXMLSave.updateXML(org.w3c.dom.Document) (OracleXMLSave.java:1372)
System Error: void
THANK YOU FOR A HELPING RESPONSE IN PARTICULAR FROM ORACLE TEAM
I am using JDev 3.2 with Oracle 8.1.6 !!Thank's Steven for responding but It is still not working... even with UpdateXML(URL) and updating only a VARCHAR2 col
even when it is stored in the DB.
But the OracleXMLQuery works fine even with Object Types !!???
The code below is more simple than your's !
I show you the entire code :
the result.xml file :
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<ROWSET>
<ROW>
<ID_PARAMETRE>16</ID_PARAMETRE>
<TYPE_PARAMETRE>OUTOUT</TYPE_PARAMETRE>
</ROW>
</ROWSET>
the row exists in DB !
public static void main(String args[]) {
MyClass.XSUloadXMLToOracle("d:\\Temp\\result.xml");
static method ! (for Deployment if needed)
class MyClass extends Object {
public static void XSUloadXMLToOracle(String sFilePath) {
try {
Connection conn = ConnectionHelper.getConnection();
OracleXMLSave save = new OracleXMLSave(conn, "PARAMETRE");
String[] updateColNames = new String[1];
updateColNames[0] = "TYPE_PARAMETRE";
String [] keyColNames = new String[1];
keyColNames[0] = "ID_PARAMETRE";
save.setUpdateColumnList(updateColNames);
save.setKeyColumnList(keyColNames);
save.updateXML(save.getURL(sFilePath));
conn.commit();
save.close();
conn.close();
catch(Exception e) {
e.printStackTrace(System.err);
System Error: oracle.xml.sql.OracleXMLSQLException: Exception d'E/S: End of TNS data channel
System Error: int oracle.xml.sql.dml.OracleXMLSave.saveXML(org.w3c.dom.Document, int) (OracleXMLSave.java:1928)
System Error: int oracle.xml.sql.dml.OracleXMLSave.saveXML(java.net.URL, int) (OracleXMLSave.java:1880)
System Error: int oracle.xml.sql.dml.OracleXMLSave.updateXML(java.net.URL) (OracleXMLSave.java:1329)
System Error: void IFPBDJ.IFPCalculsExternes.XSUloadXMLToOracle(java.lang.String) (IFPCalculsExternes.java:125)
System Error: void IFPBDJ.IFPCalculsExternes.main(java.lang.String[]) (IFPCalculsExternes.java:149)
I AM KNOW CRYING... -
Exhausted Result set and End of TNS data channel
Please reply to : [email protected] (there's hopeful :-)
Using the same code, but with different drivers I get :
8.1.7 Thin Driver : End of TNS data channel
8.1.7 OCI Driver : Exhausted Resultset
Both are talking to an 8.1.7 server.
The problems are coming at different points in the code, and seem
to be data/volume based - they are reproducible in the main, but
don't always happen.
I've checked the forums for both of these problems, but nothing
seems to match my approach - just loads of calls to simple
prepared statements generated for an OO/RDB mapping.
Any pointers appreciated - such as why these happen?
Thanks
tim
ThanksHi Liya -
"End of TNS data channel" is usually a message sent by the database when something erroneous is occuring.
What version of the database, JDBC, and JDK are you using?
Are you getting any dump files from the database?
Can you describe a little more about what the application code is doing?
There is some good information on this error message at the following URL
http://forum.java.sun.com/thread.jsp?thread=280338&forum=48&message=1090056
-steve- -
OLAP Io exception: End of TNS data channel
Hello,
I am running Oracle 9.2.0.1 on Sun 64. I applied the 9.2.0.4.0 and 9.2.0.4.1 patches and then created some relational cubes and dimensions and associated OLAP metadata. Everything validates correctly and I can see everything in OEM and AWM. When I run teh bi_checkconfig untility, I get the following:
BI Beans Diagnostics(v1.0.2.0) 3/24/05
===============================================================================
JDEV_ORACLE_HOME .......................... = C:\oracle\jdev10g
JAVA_HOME ................................. = c:\java\j2sdk1.4.2
JDeveloper version ........................ = 9.0.4.0.1407
BI Beans release description .............. = BI Beans 9.0.4 Production Release
BI Beans component number ................. = 9.0.4.22.0
BI Beans internal version ................. = 2.7.5.31
Connect to database ....................... = Successful
JDBC driver version ....................... = 9.2.0.4.0
JDBC JAR file location .................... = C:\oracle\jdev10g\jdev\lib\patches
Database version .......................... = 9.2.0.4.0
OLAP Catalog version ...................... = 9.2.0.4.1
OLAP AW Engine version .................... = 9.2.0.4.1
OLAP API Server version ................... = 9.2.0.4.1
BI Beans Catalog version .................. = N/A; not installed in dms_dw
OLAP API JAR file version ................. = 9.2
OLAP API JAR file location ................ = C:\oracle\jdev10g\jdev\lib\ext
Load OLAP API metadata .................... = Unsuccessful
============================================================================
The error in the bi_error.log file is:
1) Io exception: End of TNS data channel
1) Io exception: End of TNS data channel
============================================================================
oracle.express.idl.util.OlapiException: Io exception: End of TNS data channel
at oracle.express.idl.ExpressConnectionModule.ConnectionInterfaceStub.getDefaultDatabase(ConnectionInterfaceStub.java:1502)
at oracle.express.olapi.data.full.ExpressDataProvider.getMetadataProviderInterface(ExpressDataProvider.java:993)
at oracle.olapi.metadata.MetadataFetcher.initialize(MetadataFetcher.java:73)
at oracle.olapi.metadata.MetadataFetcher.<init>(MetadataFetcher.java:45)
at oracle.olapi.metadata.BaseMetadataProvider.<init>(BaseMetadataProvider.java:47)
at oracle.olapi.metadata.mdm.MdmMetadataProvider.<init>(MdmMetadataProvider.java:130)
at oracle.express.olapi.data.full.ExpressDataProvider.getDefaultMetadataProvider(ExpressDataProvider.java:964)
at oracle.dss.metadataManager.server.drivers.mdm._92.MDMMetadataDriverImpl_92.getMdmMetadataProvider(MDMMetadataDriverImpl_92.java:1133)
at oracle.dss.metadataManager.server.drivers.mdm._92.MDMMetadataDriverImpl_92.attach(MDMMetadataDriverImpl_92.java:810)
at oracle.dss.metadataManager.server.drivers.mdm.MDMMetadataDriverImpl.attach(MDMMetadataDriverImpl.java:125)
at oracle.dss.metadataManager.server.MetadataManagerImpl.buildObjectModel(MetadataManagerImpl.java:1092)
at oracle.dss.metadataManager.server.MetadataManagerImpl.attach(MetadataManagerImpl.java:969)
at oracle.dss.metadataManager.client.MetadataManager.attach(MetadataManager.java:876)
at oracle.dss.metadataManager.client.MetadataManager.attach(MetadataManager.java:799)
at BICheckConfig.checkConnection(BICheckConfig.java:277)
at BICheckConfig.main(BICheckConfig.java:1348)
I am at a loss. If anyone has any ideas, I would really appreciate it.
Thanks, ToddTodd,
This might be bug 4112321, which is unpublished, but has similar symptoms. A fix was submitted into the 9.2.0.7 stream. You could open a TAR, including the trace file, so that a support analyst could compare your trace file to the one posted to this bug. If they are the same, a fix could possibly be backported to 9.2.0.6, but not likely to an earlier version.
Upgrading to 9.2.0.6 would be a good idea, regardless.
--Sharon -
Java.sql.SQLException: Io exception: End of TNS data channel
Hello folks,
Has amyone encountered this exception? If so, could you please shed some light for what might be going wrong?
Here is my confuguration:
400MB RAM
1.2GHTz processor
Win2K Pro
Oracle server 9.0.1
JDBC Thin driver (libs for 9.0.1)
Scenario:
My Java code uses Oracle Spatial to insert SDO_GEOMETRY objects into my DB model.
I have a config file where I store my connection properties, e.g.,
<DBConnection name="twatest">
<JDBCDriver>oracle.jdbc.driver.OracleDriver</JDBCDriver>
<URL>jdbc:oracle:thin:@saturn:1521:saturn</URL>
<Username>user1</Username>
<Password>twatest</Password>
</DBConnection>
We have 2 schemas defined: user1 and twatest.
The problem first occured when I switched from user1 to twatest. Consequent attempt to run the process as user user1 failed! The Java SQL statements do not use schemas (so they default, I suppose, to the default schema for that particular user, in our case being user1-->user1, twatest-->twatest).
The problem happens in the following Java class (search for "HERE" to see where exactly the problem occurs):
package com.vividsolutions.twatest;
import java.util.*;
import java.sql.*;
import oracle.sql.*;
import oracle.sdoapi.OraSpatialManager;
import oracle.sdoapi.geom.*;
import oracle.sdoapi.adapter.*;
import oracle.sdoapi.sref.*;
import com.vividsolutions.twatest.parser.*;
import com.vividsolutions.twatest.config.*;
import com.vividsolutions.twatest.model.*;
* This class is responsible for loading lakes into the SDO Oracle Spatial DB.
public class LakeLoader
static boolean initialized = false;
private static GeometryFactory gF;
private static SRManager srManager;
private static SpatialReference sref;
private static GeometryAdapter sdoAdapter;
public static void loadLake(EdgedLake slake, Connection conn) throws Exception {
com.vividsolutions.jts.geom.Envelope e = slake.getEnvelope();
if (e == null) {
System.out.println("Invalid envilope (feature ID="+slake.getFeatureId()+")! Ignoring...");
return; // ignore lake - it's invalid (no envilope)
if (!initialized) {
initialize(conn);
initialized = true;
Geometry geom;
STRUCT str;
// insert Lake
String lakeQuery = "INSERT INTO lake " +
"(lake_id, area, bounding_box, name, instantiation_date) " +
"VALUES(?,?,?,?,?)";
PreparedStatement ps = conn.prepareStatement(lakeQuery);
int lakeId = getId(Lake.ID, conn);
ps.setInt(1, lakeId);
ps.setDouble(2, Double.parseDouble(slake.getArea()));
// Creates a 2-D rectangle (special case of Polygon geometry).
geom = gF.createRectangle(e.getMinX(), e.getMinY(), e.getMaxX(), e.getMaxY());
ps.setObject(3, sdoAdapter.exportGeometry(STRUCT.class, geom));
ps.setString(4, slake.getName());
ps.setTimestamp(5, new Timestamp(new java.util.Date().getTime()));
ps.executeUpdate(); // <-- HERE I got: java.sql.SQLException: Io exception: End of TNS data channel
//ps.close();
String ringQuery = null;
int ringId = 0;
List shellEdges = slake.getShellEdges();
if (shellEdges != null && shellEdges.size() > 0) { // if there is valid shell, insert it...
// insert shell Rings
ringQuery = "INSERT INTO ring (ring_id, lake_id, type) VALUES(?,?,?)";
ps = conn.prepareStatement(ringQuery);
ringId = getId(Ring.ID, conn);
ps.setInt(1, ringId);
ps.setInt(2, lakeId);
ps.setString(3, Ring.SHELL);
ps.executeUpdate();
//ps.close();
// insert shell ring Edges
insertEdges(shellEdges, lakeId, Ring.SHELL, ringId, conn);
List holeEdges = slake.getHoleEdges();
if (holeEdges != null && holeEdges.size() > 0) { // if there are valid holes, insert them...
// insert hole Rings
ringQuery = "INSERT INTO ring (ring_id, lake_id, type) VALUES(?,?,?)";
ps = conn.prepareStatement(ringQuery);
ringId = getId(Ring.ID, conn);
ps.setInt(1, ringId);
ps.setInt(2, lakeId);
ps.setString(3, Ring.HOLE);
ps.executeUpdate();
//ps.close();
// insert hole ring Edges
insertEdges(holeEdges, lakeId, Ring.HOLE, ringId, conn);
ps.close();
private static void insertEdges(List edges, int lakeId, String ringType,
int ringId, Connection conn) throws Exception {
if (!initialized) {
initialize(conn);
initialized = true;
Geometry geom;
STRUCT str;
// insert shell ring Edges
String edgeQuery = "INSERT INTO edge " +
"(edge_id, lake_id, ring_type, ring_id, edge_sequence, shape) " +
"VALUES(?,?,?,?,?,?)";
int edge_sequence = 0;
for (Iterator it=edges.iterator(); it.hasNext(); ) {
Edge edge = (Edge)it.next();
geom = gF.createLineString(LakeFactory.edgeToArray2D(edge)); // 2-dimensional coordinates
PreparedStatement ps = conn.prepareStatement(edgeQuery);
int edgeId = getId(Edge.ID, conn);
ps.setInt(1, edgeId);
ps.setInt(2, lakeId);
ps.setString(3, ringType);
ps.setInt(4, ringId);
ps.setInt(5, edge_sequence++);
ps.setObject(6, sdoAdapter.exportGeometry(STRUCT.class, geom));
ps.executeUpdate();
ps.close();
* @param key This can be: "lake", "ring", or "edge".
* @param conn The connection to use.
* @return the unique ID corresponding to the given key.
public static int getId(String key, Connection conn) {
int id = -1;
try {
String query = "SELECT "+key+"_SEQUENCE.NEXTVAL FROM DUAL";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
id = rs.getInt(1);
stmt.close();
} catch(SQLException sqle) {
sqle.printStackTrace();
return id;
private static void initialize(Connection conn) throws Exception {
gF = OraSpatialManager.getGeometryFactory();
// Set spatial reference system in which the geometries will be created
srManager = OraSpatialManager.getSpatialReferenceManager(conn);
sref = srManager.retrieve(8307);
gF.setSpatialReference(sref);
sdoAdapter = OraSpatialManager.getGeometryAdapter("SDO", "8.1.6",
null, STRUCT.class, null, conn);
public static void main(String args[]) throws Exception
String[] xmlLakeFiles = {
"lakes101to1400.xml",
"lakes1401to10000.xml",
"lakes10001to20000.xml",
"lakes20001to30000.xml",
"lakes30001to40000.xml",
"lakes40001to50000.xml",
"lakes50001to60000.xml"
PropertyManager pm = new PropertyManager();
int numberOfLoadedLakes = 0;
try {
pm.initialize();
Map modelMap = (Map)pm.get(XMLConfigFile.MODEL_MAP);
LakeModel lakeModel = (LakeModel)modelMap.get(LREConcreteLakeModel.NAME);
Connection connection = ConnectionManager.getConnection();
lakeModel.setConnection(connection);
for (int i=0; i<xmlLakeFiles.length; i++) {
long then = System.currentTimeMillis();
System.out.println("Loading lake "+xmlLakeFiles[i]+"...");
numberOfLoadedLakes = lakeModel.loadModel(xmlLakeFiles);
long now = System.currentTimeMillis();
System.out.println("Loaded "+numberOfLoadedLakes+" lakes!");
System.out.println("Execution time: "+(now-then)/1000+" seconds!");
System.out.println("Loading lake "+xmlLakeFiles[i]+"...done!");
connection.close();
} catch(Exception e) {
e.printStackTrace();
My client class calls LakeLoader.loadLake() method in a loop to load a bunch of Lake objects into the DB. The first lake in the list is created without problems, but when the 2-nd lake is being inserted, I get an exception at the preparedStatement.executeUpdate() statement. This happens consistently.
I tried to find information on this on the net, but seems that this problem only happened when people dealt with LOBs?!
Thank you very much!
GeorgiSuresh -- I'd probably log a TAR with Oracle support for this question if you definitely need it resolved. Support have access to all manner of existing cases, so this may be something they have seen before.
cheers
-steve- -
JDBC Thin Driver "End of TNS Data Channel
I don't know how much hope there is of getting this answered. It looks like most of these questions are going either ignored or simply abandoned by the Oracle staff, but here it goes.
I have an Oracle 7.3.4 database running on Netware 4.11. I was writing an app that would allow me to run a query and dump the output to Swing JTable.
I was using the JDBC 7.3.4 driver and was able to connect and run queries, however manipulating the resultset was difficult.
As I looked into moving the resultset data into a JTable, I realized I needed to make a custom Table model. JDBC 2.0 seemed to have all the features that would make this easy so I coded a TableModel that assumed JDBC 2.0 support.
I realized the 7.3.4 driver was not 2.0 compliant when I recieved an AbstractException when calling ResultSet.last()
I thought this would be no problem so I looked for a Oracle JDBC 2.0 Compliant driver that would support a 7.3.4 database.
I was happy to see that all JDBC thin clients claim to be backwards compatible. I downloaded JDBC 9.0.1 since I've upgraded to JSDK 1.3.1.
When trying to establish a connection I recieve the "IOException: End of TNS Data Channel."
I have tried all other JDBC drivers between 9.0.1 and 7.3.4 and the only driver that connects is the 7.3.4.
If anyone has any insight that could help me, please let me know. Thank you.
Jason Johnston
[email protected]Is the class you have given is complete code or is it partical code?
Are you using any JDBC calls in your actual program ?
How big is this file /Temp/kongx.txt?
Please provide us the above details ?
Regards
Ravi
Maybe you are looking for
-
Bridge/ACR don't translate settings to batch processed JPGs/PDFs
I edit a batch of RAW images in ACR via Bridge, hit "done" and then send them to Image Processor to create JPGS or use the Output Module in Bridge CC to make a PDF. Sometimes the settings I just applied in ACR don't translate to the JPGs and/or Outpu
-
I purchased my MacBook Pro in July of 2010 for school and have had to use it on a day to day basis since and therefore have not yet been able to contact apple to fix the problem that I am currently having. This problem is recent, occurring within the
-
How to I an extra page from the Chapter page that is appended to the Chapter page? No content is displayed on the page but it will not delete.
-
MPEG-1 and MPEG-2 in the same file
I am being asked to deliver a muxed file containing Video: MPEG-2 Program Audio: MPEG-1 Layer 2 I want to use Compressor to generate each as a separate file, then join them using MPEG Streamclip. But I can't get Compressor 1.2.1 to generate a file th
-
Importing DB info from Sybase to Oracle 9i
Could someone please tell me if it is possible to import a sybase db into oracle 9i. The reason, I need to be able to import and excisting DB from sybase to Oracle for a project.