Home » Developer & Programmer » JDeveloper, Java & XML » who can resolv problem about protocol violation ?
who can resolv problem about protocol violation ? [message #91608] Fri, 06 December 2002 22:58 Go to next message
perlinlee
Messages: 2
Registered: December 2002
Junior Member
I've got a exception about protocol violation when using jdbc to connect Oracle , I use Oracle8.1.5 and java1.3 , Error occured on rs.next() method . It only fetched about 170 rows data ,but there are about 1000 rows data in db.i found all the answer on internet, most of people says that the version is different between oracle and jdbc , i sure it's same , because the classxx file was copied from oracle jdbclib directory. could you resolve this problem ?

Thanks !
Perlin Lee
my email: perlinlee@163.com
Re: SOLUTION who can resolv problem about protocol violation ? [message #91616 is a reply to message #91608] Tue, 10 December 2002 10:05 Go to previous messageGo to next message
Girish
Messages: 16
Registered: September 1998
Junior Member
Perlin,

The problem of Protocol Voilation comes when you try to connect to Oracle and istead of getting response in recordset or execution there is a blockage appears. for example in Oracle if you have setup like changing userid after 90 days or 60 days. What happened is Oracle will start asking you a question that your password is expiring do you want to change it or not, It means Before connecting to Oracle JDBC is blocked by this question and Oracle needs an Answer yes or no before executing your Query. So, You have to either take the user id which never expires or see the setting in Oracle for such kind of things.

I Hope this helps you

Girish
Re: SOLUTION who can resolv problem about protocol violation ? [message #91618 is a reply to message #91616] Tue, 10 December 2002 21:14 Go to previous messageGo to next message
perlinlee
Messages: 2
Registered: December 2002
Junior Member
Girish,thanks for your response .
i got the 1000 rows data with same username and password throuth Oracle client software,so it's not cause of expiring time,the id has been set to never expire.the protocol violation exception was thrown by connection pool we wrote.i wrote another program with JDBC to connect Oracle directly without by connection pool below .

import java.io.*;
import java.lang.*;
import java.math.*;
import java.sql.*;
import java.util.*;
import java.net.*;

public class testORAFetchingLength
{
public static void main(String args[[]])
{
try {
System.out.println("###begin");
Vector v = getData();
System.out.println("###end");
} catch(Exception e){
System.out.println("main exception:"+e.getMessage());
e.printStackTrace();
} finally {
System.out.println(" ...... end");
}
}


public static Vector getData()
{
Vector vtr =new Vector();
String sql;
int columnCount;
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ResultSetMetaData meta = null;

sql="select sys_id from mps_user_balance";
try{
String driverClasses = "oracle.jdbc.driver.OracleDriver";
StringTokenizer st = new StringTokenizer(driverClasses);

while (st.hasMoreElements()) {
String driverClassName = st.nextToken().trim();

try {
Driver driver = (Driver)Class.forName(driverClassName).newInstance();
DriverManager.registerDriver(driver);
} catch (Exception e) {
System.out.println("driver exception:"+ e.getMessage());
e.printStackTrace();
}
}


conn = DriverManager.getConnection("jdbc:oracle:thin:@10.10.26.251:1521:oracle8","mps","mps");
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
meta = rs.getMetaData();
columnCount = meta.getColumnCount();

int k = 0;
while (rs.next()) {
System.out.println(k);
k++;
}
if (rs != null) rs.close();
if (stmt != null) stmt.close();
if (conn != null && !conn.isClosed()) conn.close();
}catch(Exception e){
System.out.println("exception:"+ e.getMessage());
e.printStackTrace();
}
return vtr;
}
}

i got result below .

###begin
0
.
.
.

178
179
...... end
Exception in thread "main" java.lang.OutOfMemoryError
<<no stack trace available>>

perhaps ResultSet have max length ? what can i do ?

Thanks .
Perlin
Re: SOLUTION who can resolv problem about protocol violation ? [message #91627 is a reply to message #91618] Sat, 14 December 2002 13:21 Go to previous message
Girish
Messages: 16
Registered: September 1998
Junior Member
Perlin,

I am little confused, In my previous reply I also mentioned that after connection but before executing the statement if there is any blockage then you will get protocol voilation error, So, it could be your connection pooling program too. which is connecting to oracle but before returning rows it is behaving differently instead of returning rows to recordset.

Now the above example you showed me, It is has error displayed " java.lang.OutOfMemoryError "
at last. Do you want me to look at it or just for my knowledge sake you sent this me.

Girish
Previous Topic: Problem with Connection Pooling
Next Topic: USing XML SAX Parser in PL/SQL
Goto Forum:
  


Current Time: Fri Apr 19 19:28:28 CDT 2024