You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Kathey Marsden <km...@sbcglobal.net> on 2010/05/12 20:47:48 UTC
Just heads up, possible protocol error issue on 10.6
I just started IPv6 testing and hit the error below. I am not sure what
it's all about, but will investingate more thoroughly and get a Jira
filed this afternoon.
66 java org.apache.derby.drda.NetworkServerControl start -h
2002:92a:8f7a:13
:9:42:73:216&
67 java DataSourceTest
Exception in thread "main" java.sql.SQLNonTransientConnectionException:
Network
protocol exception: actual code point, 4,692, does not match expected
code point
, 9,224. The connection has been terminated.
at
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unkn
own Source)
at
org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
e)
at org.apache.derby.client.am.Statement.executeUpdate(Unknown
Source)
at DataSourceTest.GrantRevokeTest(DataSourceTest.java:46)
at DataSourceTest.main(DataSourceTest.java:25)
Caused by: org.apache.derby.client.am.DisconnectException: Network
protocol exce
ption: actual code point, 4,692, does not match expected code point,
9,224. The
connection has been terminated.
at
org.apache.derby.client.net.Reply.parseLengthAndMatchCodePoint(Unknow
n Source)
at
org.apache.derby.client.net.NetConnectionReply.parseSQLCARD(Unknown S
ource)
at
org.apache.derby.client.net.NetConnectionReply.parseRDBCMMreply(Unkno
wn Source)
at
org.apache.derby.client.net.NetConnectionReply.readLocalCommit(Unknow
n Source)
at
org.apache.derby.client.net.ConnectionReply.readLocalCommit(Unknown S
ource)
at
org.apache.derby.client.net.NetConnection.readLocalCommit_(Unknown So
urce)
at org.apache.derby.client.am.Connection.readCommit(Unknown Source)
at org.apache.derby.client.am.Connection.readAutoCommit(Unknown
Source)
at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
at org.apache.derby.client.am.Statement.executeUpdateX(Unknown
Source)
... 3 more
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.InputStream;
import org.apache.derby.jdbc.EmbeddedDataSource;
import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource;
import org.apache.derby.jdbc.EmbeddedXADataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.SQLException;
import javax.sql.DataSource;
public class DataSourceTest{
public static void main(String[] args) throws Exception {
javax.sql.DataSource ds = getDS("mydb;create=true", null, null);
Connection conn = ds.getConnection("user2", "pass2");
//DropTables(conn);
GrantRevokeTest(conn);
TestPStmt(conn);
TestClob(conn);
TestBlob(conn);
TestClobBlob(conn);
TestFunction(conn);
}
public static void DropTables(Connection conn) throws Exception{
Statement stmt = conn.createStatement();
stmt.executeUpdate("drop table tab2");
stmt.executeUpdate("drop table tabclob");
stmt.executeUpdate("drop table tabblob");
stmt.executeUpdate("drop table tabclobblob");
stmt.executeUpdate("drop function f_abs");
stmt.executeUpdate("drop table tabfunction");
stmt.close();
}
public static void GrantRevokeTest(Connection conn) throws Exception{
Statement stmt = conn.createStatement();
stmt.executeUpdate("create table tab2(c1 int, c2 char(3))");
stmt.executeUpdate("grant select on tab2 to public");
ResultSet rs = stmt.executeQuery("select GRANTEE, GRANTOR,
SELECTPRIV, DELETEPRIV, INSERTPRIV, UPDATEPRIV, REFERENCESPRIV,
TRIGGERPRIV from sys.systableperms");
while(rs.next())
{
System.out.println("Gtrantee in the systableperms : " +
rs.getString(1));
}
stmt.executeUpdate("grant select on tab2 to public");
stmt.close();
rs.close();
System.out.println("GrantRevokeTest Passed");
}
public static void TestPStmt(Connection conn) throws Exception{
PreparedStatement ps = conn.prepareStatement("insert into tab2
values(?,?)");
Statement stmt = conn.createStatement();
for(int i=0;i<10;i++){
ps.setInt(1,i);
ps.setString(2,"aa" +i);
ps.executeUpdate();
}
ResultSet rs = stmt.executeQuery("select * from tab2");
while(rs.next())
System.out.println("Col1: "+rs.getInt(1));
stmt.close();
ps.close();
rs.close();
System.out.println("TestPStmt Passed");
}
public static void TestClob(Connection conn) throws Exception{
String insertRow = "insert into tabclob values(?,?)";
String ss= "create table tabclob(a int, b clob(3M))";
Statement stmt = conn.createStatement();
stmt.executeUpdate(ss);
PreparedStatement Insert = conn.prepareStatement(insertRow);
Insert.setInt(1,1);
try {
File inputfile = new File("l1.txt");
FileReader fr = new FileReader(inputfile);
BufferedReader br = new BufferedReader(fr);
Insert.setCharacterStream(2, fr, (int) inputfile
.length());
} catch (FileNotFoundException e) {
System.out.println("File not found Exception : " +
e.getMessage());
throw e;
}
int rows = Insert.executeUpdate();
System.out.println("Rows inserted: " + rows);
stmt.close();
Insert.close();
System.out.println("TestClob passed");
}
public static void TestBlob(Connection conn) throws Exception{
String insertRow = "insert into tabblob values(?,?)";
String ss= "create table tabblob(a int, b blob(3M))";
Statement stmt = conn.createStatement();
stmt.executeUpdate(ss);
PreparedStatement Insert = conn.prepareStatement(insertRow);
Insert.setInt(1,1);
try{
File inputfile = new File("p1.jpg");
InputStream fileIn = new FileInputStream(inputfile);
Insert.setBinaryStream(2, fileIn, (int) inputfile.length());
}catch (FileNotFoundException e) {
System.out.println("File not found Exception : " +
e.getMessage());
throw e;
}
int rows = Insert.executeUpdate();
System.out.println("Rows inserted: " + rows);
stmt.close();
Insert.close();
System.out.println("TestBlob passed");
}
public static void TestClobBlob(Connection conn) throws Exception{
String insertRow = "insert into tabclobblob values(?,?)";
String ss= "create table tabclobblob(a clob(3M), b blob(3M))";
Statement stmt = conn.createStatement();
stmt.executeUpdate(ss);
PreparedStatement Insert = conn.prepareStatement(insertRow);
ResultSet rs = stmt.executeQuery("select a, b from tabBlob");
Blob blob = null;
Clob clob = null;
while (rs.next())
blob = rs.getBlob(2);
if (blob != null)
Insert.setBlob(2,blob);
rs = stmt.executeQuery("select a, b from tabclob");
while (rs.next())
clob = rs.getClob(2);
if (clob != null)
Insert.setClob(1,clob);
int rows = Insert.executeUpdate();
System.out.println("Rows inserted: " + rows);
rs.close();
stmt.close();
Insert.close();
System.out.println("TestClobBlob Passed");
}
public static void TestFunction(Connection conn)throws Exception{
Statement stmt = conn.createStatement();
int result = stmt.executeUpdate(
"CREATE FUNCTION F_ABS(P1 INT) RETURNS INT NO "
+ "SQL RETURNS NULL ON NULL INPUT EXTERNAL NAME "
+ "'java.lang.Math.abs' LANGUAGE JAVA PARAMETER STYLE JAVA");
int abs = 0;
ResultSet rs = stmt.executeQuery(" values f_abs(-5)");
while(rs.next())
abs = rs.getInt(1);
System.out.println("abs value: " + abs);
String insertRow = "insert into tabfunction values(?,?)";
String ss= "create table tabfunction(a int, b int)";
//Statement stmt = conn.createStatement();
stmt.executeUpdate(ss);
PreparedStatement Insert = conn.prepareStatement(insertRow);
Insert.setInt(1,1);
Insert.setInt(2,abs);
int rows = Insert.executeUpdate();
System.out.println("Rows inserted: " + rows);
Insert.close();
stmt.close();
rs.close();
System.out.println("TestFunction Passed");
}
public static javax.sql.DataSource getDS(String database, String user,
String
password) throws SQLException
{
org.apache.derby.jdbc.ClientDataSource ds =
new org.apache.derby.jdbc.ClientDataSource();
// DatabaseName can include Derby URL Attributes
ds.setDatabaseName(database);
if (user != null)
ds.setUser(user);
if (password != null)
ds.setPassword(password);
// The host on which Network Server is running
//edit this to the name of the server(IPV6) you are using
ds.setServerName("wicopt1-v6.rtp.raleigh.ibm.com");
// port on which Network Server is listening
ds.setPortNumber(1527);
return ds;
}
}
Re: Just heads up, possible protocol error issue on 10.6
Posted by Kathey Marsden <km...@sbcglobal.net>.
On 5/12/2010 11:47 AM, Kathey Marsden wrote:
> I just started IPv6 testing and hit the error below. I am not sure
> what it's all about, but will investingate more thoroughly and get a
> Jira filed this afternoon.
>
>
It actually appears to be a security manager issue as it doesn't
reproduce with -noSecurityManager and the actual error in the derby.log is.
============= begin nested exception, level (1) ===========
ERROR XSLAQ: cannot create log file at directory
/home/kmarsden/ipv6test/mydb/log.
at
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at
org.apache.derby.impl.store.raw.log.LogToFile.getLogDirectory(Unknown
Source)
at
org.apache.derby.impl.store.raw.log.LogToFile.getLogFileName(Unknown Source)
at
org.apache.derby.impl.store.raw.log.LogToFile.getLogFileAtPosition(Unknown
Source)
at org.apache.derby.impl.store.raw.log.Scan.<init>(Unknown Source)
at
org.apache.derby.impl.store.raw.log.LogToFile.openBackwardsScan(Unknown
Source)
at org.apache.derby.impl.store.raw.log.FileLogger.undo(Unknown Source)
at org.apache.derby.impl.store.raw.xact.Xact.popSavePoints(Unknown
Source)
at
org.apache.derby.impl.store.raw.xact.Xact.rollbackToSavePoint(Unknown
Source)
at
org.apache.derby.impl.store.access.RAMTransaction.rollbackToSavePoint(Unknown
Source)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.internalRollbackToSavepoint(Unknown
Source)
at
org.apache.derby.impl.sql.conn.GenericStatementContext.cleanupOnError(Unknown
Source)
at
org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(Unknown
Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(Unknown Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown
Source)
at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLIMM(Unknown
Source)
at
org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
I am guessing it is there is an unreported security exception in
LogFile where we call
protected boolean privExists(StorageFile file)
{
return runBooleanAction(0, file);
}
private synchronized boolean runBooleanAction(int action,
StorageFile file) {
this.action = action;
this.activeFile = file;
try {
return ((Boolean)
java.security.AccessController.doPrivileged(this)).booleanValue();
} catch (java.security.PrivilegedActionException pae) {
return false;
}
}
I put a 10.7 build over there which prints a stack trace when a
permission error occurs to find out what the exception is exactly
happening of course it did not reproduce. I am going to narrow the
10.6 reproduction a bit and then file a bug. Then I will check out the
10.6 branch and work with that. Sorry for all the verbosity, but since
I think it might be a show stopper I thought it good to send updates.
Kathey
> 66 java org.apache.derby.drda.NetworkServerControl start -h
> 2002:92a:8f7a:13
> :9:42:73:216&
> 67 java DataSourceTest
>
>
> Exception in thread "main"
> java.sql.SQLNonTransientConnectionException: Network
> protocol exception: actual code point, 4,692, does not match expected
> code point
> , 9,224. The connection has been terminated.
> at
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unkn
> own Source)
> at
> org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
> e)
> at org.apache.derby.client.am.Statement.executeUpdate(Unknown
> Source)
> at DataSourceTest.GrantRevokeTest(DataSourceTest.java:46)
> at DataSourceTest.main(DataSourceTest.java:25)
> Caused by: org.apache.derby.client.am.DisconnectException: Network
> protocol exce
> ption: actual code point, 4,692, does not match expected code point,
> 9,224. The
> connection has been terminated.
> at
> org.apache.derby.client.net.Reply.parseLengthAndMatchCodePoint(Unknow
> n Source)
> at
> org.apache.derby.client.net.NetConnectionReply.parseSQLCARD(Unknown S
> ource)
> at
> org.apache.derby.client.net.NetConnectionReply.parseRDBCMMreply(Unkno
> wn Source)
> at
> org.apache.derby.client.net.NetConnectionReply.readLocalCommit(Unknow
> n Source)
> at
> org.apache.derby.client.net.ConnectionReply.readLocalCommit(Unknown S
> ource)
> at
> org.apache.derby.client.net.NetConnection.readLocalCommit_(Unknown So
> urce)
> at org.apache.derby.client.am.Connection.readCommit(Unknown
> Source)
> at
> org.apache.derby.client.am.Connection.readAutoCommit(Unknown Source)
> at org.apache.derby.client.am.Statement.flowExecute(Unknown
> Source)
> at org.apache.derby.client.am.Statement.executeUpdateX(Unknown
> Source)
> ... 3 more
>
>
> import java.io.BufferedReader;
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.FileNotFoundException;
> import java.io.FileReader;
> import java.io.InputStream;
>
> import org.apache.derby.jdbc.EmbeddedDataSource;
> import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource;
> import org.apache.derby.jdbc.EmbeddedXADataSource;
> import java.sql.Connection;
> import java.sql.ResultSet;
> import java.sql.PreparedStatement;
> import java.sql.Statement;
> import java.sql.Blob;
> import java.sql.Clob;
> import java.sql.SQLException;
> import javax.sql.DataSource;
>
> public class DataSourceTest{
> public static void main(String[] args) throws Exception {
> javax.sql.DataSource ds = getDS("mydb;create=true", null, null);
> Connection conn = ds.getConnection("user2", "pass2");
> //DropTables(conn);
> GrantRevokeTest(conn);
> TestPStmt(conn);
> TestClob(conn);
> TestBlob(conn);
> TestClobBlob(conn);
> TestFunction(conn);
>
> }
> public static void DropTables(Connection conn) throws Exception{
> Statement stmt = conn.createStatement();
> stmt.executeUpdate("drop table tab2");
> stmt.executeUpdate("drop table tabclob");
> stmt.executeUpdate("drop table tabblob");
> stmt.executeUpdate("drop table tabclobblob");
> stmt.executeUpdate("drop function f_abs");
> stmt.executeUpdate("drop table tabfunction");
> stmt.close();
> }
>
> public static void GrantRevokeTest(Connection conn) throws Exception{
> Statement stmt = conn.createStatement();
> stmt.executeUpdate("create table tab2(c1 int, c2 char(3))");
> stmt.executeUpdate("grant select on tab2 to public");
> ResultSet rs = stmt.executeQuery("select GRANTEE, GRANTOR,
> SELECTPRIV, DELETEPRIV, INSERTPRIV, UPDATEPRIV, REFERENCESPRIV,
> TRIGGERPRIV from sys.systableperms");
> while(rs.next())
> {
> System.out.println("Gtrantee in the systableperms : " +
> rs.getString(1));
> }
> stmt.executeUpdate("grant select on tab2 to public");
> stmt.close();
> rs.close();
> System.out.println("GrantRevokeTest Passed");
> }
>
> public static void TestPStmt(Connection conn) throws Exception{
> PreparedStatement ps = conn.prepareStatement("insert into tab2
> values(?,?)");
> Statement stmt = conn.createStatement();
> for(int i=0;i<10;i++){
> ps.setInt(1,i);
> ps.setString(2,"aa" +i);
> ps.executeUpdate();
> }
> ResultSet rs = stmt.executeQuery("select * from tab2");
> while(rs.next())
> System.out.println("Col1: "+rs.getInt(1));
> stmt.close();
> ps.close();
> rs.close();
> System.out.println("TestPStmt Passed");
> }
>
> public static void TestClob(Connection conn) throws Exception{
> String insertRow = "insert into tabclob values(?,?)";
> String ss= "create table tabclob(a int, b clob(3M))";
> Statement stmt = conn.createStatement();
> stmt.executeUpdate(ss);
> PreparedStatement Insert = conn.prepareStatement(insertRow);
> Insert.setInt(1,1);
> try {
> File inputfile = new File("l1.txt");
> FileReader fr = new FileReader(inputfile);
> BufferedReader br = new BufferedReader(fr);
> Insert.setCharacterStream(2, fr, (int) inputfile
> .length());
> } catch (FileNotFoundException e) {
> System.out.println("File not found Exception : " +
> e.getMessage());
> throw e;
> }
> int rows = Insert.executeUpdate();
> System.out.println("Rows inserted: " + rows);
> stmt.close();
> Insert.close();
> System.out.println("TestClob passed");
>
> }
> public static void TestBlob(Connection conn) throws Exception{
> String insertRow = "insert into tabblob values(?,?)";
> String ss= "create table tabblob(a int, b blob(3M))";
> Statement stmt = conn.createStatement();
> stmt.executeUpdate(ss);
> PreparedStatement Insert = conn.prepareStatement(insertRow);
> Insert.setInt(1,1);
> try{
> File inputfile = new File("p1.jpg");
> InputStream fileIn = new FileInputStream(inputfile);
> Insert.setBinaryStream(2, fileIn, (int) inputfile.length());
> }catch (FileNotFoundException e) {
> System.out.println("File not found Exception : " +
> e.getMessage());
> throw e;
> }
> int rows = Insert.executeUpdate();
> System.out.println("Rows inserted: " + rows);
> stmt.close();
> Insert.close();
> System.out.println("TestBlob passed");
>
> }
>
> public static void TestClobBlob(Connection conn) throws Exception{
>
> String insertRow = "insert into tabclobblob values(?,?)";
> String ss= "create table tabclobblob(a clob(3M), b
> blob(3M))";
> Statement stmt = conn.createStatement();
> stmt.executeUpdate(ss);
> PreparedStatement Insert = conn.prepareStatement(insertRow);
> ResultSet rs = stmt.executeQuery("select a, b from tabBlob");
> Blob blob = null;
> Clob clob = null;
> while (rs.next())
> blob = rs.getBlob(2);
> if (blob != null)
> Insert.setBlob(2,blob);
> rs = stmt.executeQuery("select a, b from tabclob");
> while (rs.next())
> clob = rs.getClob(2);
> if (clob != null)
> Insert.setClob(1,clob);
> int rows = Insert.executeUpdate();
> System.out.println("Rows inserted: " + rows);
> rs.close();
> stmt.close();
> Insert.close();
> System.out.println("TestClobBlob Passed");
>
> }
>
> public static void TestFunction(Connection conn)throws Exception{
> Statement stmt = conn.createStatement();
> int result = stmt.executeUpdate(
> "CREATE FUNCTION F_ABS(P1 INT) RETURNS INT NO "
> + "SQL RETURNS NULL ON NULL INPUT EXTERNAL NAME "
> + "'java.lang.Math.abs' LANGUAGE JAVA PARAMETER STYLE JAVA");
> int abs = 0;
> ResultSet rs = stmt.executeQuery(" values f_abs(-5)");
> while(rs.next())
> abs = rs.getInt(1);
> System.out.println("abs value: " + abs);
> String insertRow = "insert into tabfunction values(?,?)";
> String ss= "create table tabfunction(a int, b int)";
> //Statement stmt = conn.createStatement();
> stmt.executeUpdate(ss);
> PreparedStatement Insert = conn.prepareStatement(insertRow);
> Insert.setInt(1,1);
> Insert.setInt(2,abs);
> int rows = Insert.executeUpdate();
> System.out.println("Rows inserted: " + rows);
> Insert.close();
> stmt.close();
> rs.close();
> System.out.println("TestFunction Passed");
>
> }
>
> public static javax.sql.DataSource getDS(String database, String user,
> String
> password) throws SQLException
> {
> org.apache.derby.jdbc.ClientDataSource ds =
> new org.apache.derby.jdbc.ClientDataSource();
>
> // DatabaseName can include Derby URL Attributes
> ds.setDatabaseName(database);
>
> if (user != null)
> ds.setUser(user);
> if (password != null)
> ds.setPassword(password);
>
> // The host on which Network Server is running
> //edit this to the name of the server(IPV6) you are using
> ds.setServerName("wicopt1-v6.rtp.raleigh.ibm.com");
>
> // port on which Network Server is listening
> ds.setPortNumber(1527);
>
> return ds;
> }
>
> }
>
>
>
>
>