java.sql.SQLException: Protocol violation

Exception in thread “main” java.sql.SQLException: Protocol violation: [1]                 at oracle.jdbc.driver.T4CTTIfun.receive(                 at oracle.jdbc.driver.T4CTTIfun.doRPC(                 at oracle.jdbc.driver.T4C7Ocommoncall.doOLOGOFF(                 at oracle.jdbc.driver.T4CConnection.logoff(                 at oracle.jdbc.driver.PhysicalConnection.close(                at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Connection con=createConnection(); Con.close(); Con.commit(); Con.close();   Here, commit() is invoked after the connection is closed, hence the above exception occurred.

java.lang.ArrayIndexOutOfBoundsException while executing batch Statements in Java

I have created a PreparedStatement to execute a batch of insert statements. But while executing, the below exception 22 at oracle.jdbc.driver.T4CNumberAccessor.unmarshalOneRow( at oracle.jdbc.driver.T4C8Oall.readRXD( at oracle.jdbc.driver.T4CTTIfun.receive( at oracle.jdbc.driver.T4CTTIfun.doRPC( at oracle.jdbc.driver.T4C8Oall.doOALL( at oracle.jdbc.driver.T4CPreparedStatement.doOall8( at oracle.jdbc.driver.T4CPreparedStatement.executeForRows( at oracle.jdbc.driver.OraclePreparedStatement.executeForRowsWithTimeout( at oracle.jdbc.driver.OraclePreparedStatement.executeBatch( at oracle.jdbc.driver.OracleStatementWrapper.executeBatch( at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  Solution:   After googling, I realized that the PreparedStatement is not accepting more than 6 parameters. Below is…

Using excel file as DB and read data from Java

Java, SQL By May 14, 2014 No Comments

We can use an excel file as a data base. Using java we can create connection to excel file and execute sql query as we do with database. Use the below code to use excel file as a DB and read data from it using java. String stExcelFile=”c:\temp\test.xls”; String stSheetName=”Sheet1”; Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);         Connection conExcel = DriverManager.getConnection(“jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=” +…


As the name implies when the requested operation is not supported, we get this error. Below is a sample program to generate this error.   public static void main(String args[]){String st[]={“Hi”,”Hello”,”Bye”};List list=Arrays.asList(st);list.add(“Anand”); //Get error at this line System.out.println(” List: “+list);}    If we run this method, we get the below error because we are trying to add a new element to…

Changing End point address of web service in ADF

  Below code explains how to change the web service end point through program.  ServiceRequestService serviceRequestService = new ServiceRequestService(); ServiceRequestPortType serviceRequestPortType = serviceRequestService.getServiceRequestPortType();  BindingProvider bp = (BindingProvider)serviceRequestPortType;            bp.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, “http://localhost:9950/soa-infra/services/default/sr_v2/ServiceRequest.service”);  Here is the explanation for this code. Get port object of the web service Type cast the port object to BindingProvider object  BindingProvider class provides a member method getRequestContext() which…

Hi, Welcome here.
And get notified everytime we publish a new blog post.