Thursday, September 6, 2018

Informix 12.10 docker image (Rest Services)

You can find the docker image for "informix 12.10" database at following location. Informix 12.10 is rest enabled. That means CRUD opreations can be done using rest services without JDBC connectivity.


For demonstration purposes, you can use above docker image as a informix database.

You can use standard http requests to CRUD operations.

insert = POST
get = GET
update = PUT 
delete = DELETE etc

Sample requests

Sample Testing

database = test_db
table = test_tbl
table schema = id int(11), name varchar(20)

Insert request

http://192.168.111.132:27018/test_db/test_tbl

{
  "id":0,
  "name":"sujith"
}

Get request

http://192.168.111.132:27018/test_db/test_tbl

{
{
  "id":0,
  "name":"sujith"
},
{
  "id":1,
  "name":"delachithra"
}
}

Update request

http://192.168.111.132:27018/test_db/test_tbl/id/2

{
  "id":2,
  "name":"test update"
}

Delete request

http://192.168.111.132:27018/test_db/test_tbl/id/2

Monday, August 13, 2018

Retrieve application running on ports in windows

Use netstat command to get application list running on specific ports.

netstat -anob

Run the above command as administrator in command prompt.


Thursday, June 21, 2018

Protect PDF using password in iText

When you need to protect PDF files using password, you can use following iText codes to encrypt PDF using passwords.

String ownerPasswd="owner";
String userPasswd="user";

PdfReader reader = new PdfReader("/apps/abc.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("/apps/abc_pw.pdf"));
stamper.setEncryption(userPasswd.getBytes(), ownerPasswd.getBytes(),
PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA);
stamper.close();
reader.close();

Library versions used,
itextpdf-5.5.10.jar
bcprov-ext-jdk14-1.47.jar

You can use preferred encryption algorithms. Refer documentations.

Wednesday, March 21, 2018

Weblogic certificate issues

"The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object:"

"javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received"

Above error was raised while accessing https URL in application server. To avoid this error, we have following options.

  1. Install certificate in cacert to trust the certificate (JAVA_HOME/jre/lib/security)
  2. Install certificate in a key store and refer it
  3. Install certificate in Linux server
For the option 3, you can download https URL in server. Following commands can be used to download page using curl or wget.

curl - k https://www.google.com
wget https://www.google.com

Since, this is a valid http request server will install certificate in Linux server and validate requests against it.

Sunday, February 18, 2018

java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method

Above error was occurred in Maven project while running application in weblogic server. It can be ignored by modifying pom.xml file as below.

<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
</exclusion>
</exclusions>
</dependency>