I have made two classes, a SQL reader and a SQL Compiler. For testing purposes I read in and executed a set of scripts which came with derby, the derbytutor folder. What I cant figure out is why no more than three scripts actually execute without a particular error occuring. This error being A network protocol error was encountered and the connection has been terminated: A PROTOCOL Data Stream Syntax Error was detected. Reason: 0x9,236. Plaintext connection attempt to an SSL enabled server?
A network protocol error was encountered and the connection has been terminated: A PROTOCOL Data Stream Syntax Error was detected. Reason: 0x9,236. Plaintext connection attempt to an SSL enabled server?
I am running the java application as a Client with the Client/Server architecture. Also the scripts are quiet long if that could be a factor ?
The order of the scripts are as follows:
1 - Make the schema (Runs fine no error)
2 - Insert Script1 - Runs fine
2 - Insert Script2 - Runs fine
3 - Third Script returns that error.Its not with the syntax otherwise it would of been apparent
Here is the main method which runs through the script conversion and execution
scriptRead scriptBuffer = new scriptRead();
scriptCompiler exec = new scriptCompiler();
try {
final long start = System.currentTimeMillis();
//Load Scripts
String[] schema = scriptBuffer.getScript("schema.sql");
String[] t1 = scriptBuffer.getScript("t1.sql");
String[] t2 = scriptBuffer.getScript("t2.sql");
String[] t3 = scriptBuffer.getScript("t3.sql");
scriptCompiler sc = new scriptCompiler();
//Run scripts
sc.execute(schema);
sc.execute(t1);
sc.execute(t2);
sc.execute(t3);// Problem statement
final long end = System.currentTimeMillis();
long fin = end - start;
System.out.println("Took a time... : " + fin);
}catch(Throwable exc){
System.err.print(exc.getMessage()+"\n");
}
Here is the script execution code..
public void makeConn() throws SQLException, ClassNotFoundException{
Class.forName(driver);
conn = DriverManager.getConnection(url);
}
@SuppressWarnings("CallToThreadDumpStack")
public void execute(String[] query){
try{
makeConn();
try{
stmt = conn.createStatement();
for(int x = 0; x < query.length;x++){
stmt.execute(query[x]);
}
stmt.close();
closeConn();
}catch(SQLException err){
//err.printStackTrace();
System.err.println(err.getMessage());
}
}catch(Throwable e){
if(e instanceof SQLException){
if(((SQLException)e).equals("08001")){
System.err.println( "Incorrect Username or Password");
}else{
System.err.println( "Check Server is running");
}
}else{
System.err.println("Could not find class path");
}
}
}
I really have no idea where the problems lies ? If it was SQL Syntax fair enough, but then why are the other scripts executing.
Three ideas to start your diagnosis:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.