miércoles, 19 de diciembre de 2012

INSERT CLOB ORACLE

import oracle.sql.CLOB;
import java.sql.PreparedStatement;


 CLOB tempClob = null;
 String texto = "texto muy muy muy largo"; 
 Connection cnx = conexionBD.getConexion();

 String strSQL = "insert into tabla values (?,?,?,?,?,?)";
 PreparedStatement ps = cnx.prepareStatement(strSQL);
      tempClob = CLOB.createTemporary(cnx, true,   CLOB.DURATION_SESSION);

 tempClob.open(CLOB.MODE_READWRITE);
 Writer tempClobWriter = tempClob.getCharacterOutputStream();
 tempClobWriter.write(texto);
 tempClobWriter.flush();
 tempClobWriter.close();
 tempClob.close();

 ps.setInt(1, maxId);
 ps.setInt(2, siteIdCliente);
 ps.setString(3, nombreReporteAdd );
 ps.setString(4, comentarioReporteAdd );
 ps.setClob(5, tempClob);
 ps.setString(6, categoriaReporteAdd );
 ps.execute();
 cnx.close();
 ps.close();

jueves, 13 de diciembre de 2012

java.lang.OutOfMemoryError OC4J

500 Internal Server Error 
 java.lang.OutOfMemoryError

Para Aumentar la Memoria en OC4J

1. Detener Instancia OC4J
2. Cambiar Opciones de java
-Xrs -server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true
por
-Xrs -server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Xms512m -Xmx512m
3. Levantar Instancia OC4J


miércoles, 12 de diciembre de 2012

resetFileTransaction (OC4J)

Español
Fallo al desplegar la aplicación Web "XXXXX". Fallo al desplegar la aplicación Web "XXXXX". . Hay otra operación en curso que evita que la operación termine en este momento. Vuelva a intentar esta operación más tarde. Resolución:: Si está utilizando un repositorio basado en archivos y no hay ninguna otra operación simultánea, utilice el comando resetFileTransaction de la utilidad dcmctl para limpiar cualquier operación del repositorio basada en archivos que haya terminado de forma anormal.

Ingles
Failed to deploy web application "XXXXXX". Failed to deploy web application "XXXXX". . Another ongoing operation prevents the operation ends at this point. Retry the operation later. Resolution :: If you are using a file-based repository and no other simultaneous operation, use the dcmctl utility resetFileTransaction to clean any operation of file-based repository that has terminated abnormally. Solución:
1.opmnctl: stopping
2.Desde línea de comandos cmd ejecutar   HOMESERVER\dcm\bin> dcmctl resetfiletransaction
3.opmnctl:  startall

martes, 11 de diciembre de 2012

CLOB to String JAVA

Para poder Transformar una columna CLOB en STRING debemos hacer lo siguiente
String strSQL = "select CLOBCOLUMN from TABLE where id=1"
Statement stmt = Cnx.createStatement();
rs = stmt.executeQuery(strSQL);

while(rs.next()){

  Clob clob = rs.getClob(1);  
  
   if (clob != null) {
     if ((int) clob.length() > 0) {  
        query = clob.getSubString(1, (int) clob.length());  
       
     }  
  }
}

System.out.println(query);

miércoles, 28 de noviembre de 2012

sábado, 3 de noviembre de 2012

Toad DBA Suite for Oracle 10.6.1 Commercial

Toad Versión 10.6.1 Comercial para Oracle

Mediafire: Parte 1 Parte 2 Parte 3 Parte 4 Parte 5 -->