Category Archives: Java
Squareroot (sqrt) with BigDecimal
Recently I was refactoring some code from using double to using BigDecimal and suddenly needed a square root method. I remembered years ago I was taught a simple “successive approximation” method; believe it was grammar school. I searched the net … Continue reading
Implementing a simple database semaphore
In this article I will describe a simple technique that enables you to implement an “exclusive lock” in a distributed, even clustered, environment. The technique works with all major databases, and should work with any database that has a reasonable … Continue reading
Financial (monetary) computations using floating point arithmetic [in JAVA]
In this article, I will discuss some of the issues in doing financial calculations in JAVA. The issues are not related to JAVA only, but to any calculation done in a “computer language” using binary floating point arithmetic, including calculations … Continue reading
Securing J[2]EE applications, part 3
In this third article, the samples are modified to be run on JBoss (4.0.3+) and JavaDB (Derby version 10.2). The first article showed how to setup Glassfish authentication with only a single database table. The second article evovled the simple … Continue reading
Securing J[2]EE applications, part 2
The first part, Securing J[2]EE applications, part 1, discusses a simple setup where a single database table, 2 views and a correctly configured jdbcRealm could handle the most basic authentication and authorization requirements. This second article discusses a few enhancements … Continue reading
Securing J[2]EE applications, part 1
I’m writing a few articles about securing J2EE applications. The setup is a Glassfish v2 as application server and PostgreSQL v8.3 as database server, keeping it open-source and free 🙂 This first part discusses a simple setup where only a … Continue reading
Trusting any “secure” host
My main concern is developing server-side JAVA-applications: J[2]EE applications. When working with hobby-projects, I’m often faced with situations where I need to call other “third-party” applications over HTTP, in order to obtain some information important to me in specific situations. … Continue reading
Writing JDBC code: resource cleanup and exception handling
No matter how nice an ORM tool used in the project, CMP, Hibernate or JPA, You will eventually have to start writing “low-level” JDBC code. Most often for performance reasons, sometimes just to utilize some database-vendor-specific feature. Or calling stored … Continue reading
The “changing the database” experience
I have been involved in Enterprise JAVA projects since 1998. Almost all projects have had an RDBMS “behind” it, mostly Oracle and DB2. All the projects have been some custom defined application often based on existing infrastructure, and the database … Continue reading
Real world distributed transactions in J2EE – Not ?
I’m on this project where we develop a component. This is a J2EE component, it has its own database and it does some mainframe communication. This component is to be deployed on a WebSphere application server, version 6.1 (WAS). The … Continue reading