The NUMBER datatype without precision

Lately I have seen projects using the NUMBER datatype for table columns without setting precision and scale. When I see this I always question “Is this intentional or did they just happen to forget to set the values?”. This is the problem with using implicit configuration/settings. You don’t really know if it was a mistake or intentional. So I usually go for the explicit definitions (but of course … it depends).
Continue Reading »

Redundant NOT NULLs in DDL

I often see DDLs with NOT NULL definitions which is really redundant. When I see such DDLs I really question “do the writer really know what he or she is doing”. They might not hurt you application, but why set them if they are redundant? (If you know I reason please comment)

Example:

CREATE TABLE post (
   id NUMBER(19,0) GENERATED ALWAYS AS IDENTITY NOT NULL ,
   title VARCHAR2(255 CHAR),
   version NUMBER(10,0) NOT NULL,
   PRIMARY KEY (id));

In this case I can see two reasons why I would NOT define the ID column with a NOT NULL constraint.
Continue Reading »

Java and JDBC for Oracle DBAs – Part 6: Spring-boot, JPA and Hibernate

In the last article we looked at Spring-boot and accessed the database using the JdbcTemplate class.Today we’ll rewrite the same application but by using JPA and Hibernate instead. The Spring Initializr web page have changed a little since the last time, so the first part will be a little different.

Continue Reading »

PLSQL: Nice little overview of the PL/SQL language

I just came over these slides and nice little overview of the PL/SQL language by Morten Braten. The slides covers many good tips to follow when coding PL/SQL. It’s not ment to be an introduction to the PL/SQL language, so many topics are just mention briefly and would need to be followed by further reading and/or investigation. But it is definitely worth a look!

MacOS: Finally a text editor competing with Notepad++

There is only one thing I used to miss from my Windows environment – Notepad++. After switching to Mac and OSX I have been looking for an alternative. For a while I was using Atom, but did not really find it efficient. So I often ended up using the default TextEdit utility.

The other day I got a tip from a Java developer at Bouvet. He was using Visual Studio Code 2 (https://code.visualstudio.com/) . I have used this for two weeks now, and is very very happy with it. Finally a text editor which beets Notepad++.

Java and JDBC for Oracle DBAs – Part 5: Spring-Boot, JdbcTemplate & DB migration (Using FlywayDB)

Today we’ll be looking at Spring-boot and a tools which developers use to migrate databases, FlywayDB. We’ll also look at how you can automate grants towards our two roles (which we created in part 3) whenever new tables are created.

Continue Reading »

Java and JDBC for Oracle DBAs – Part 4: Your first JDBC Application

This is the fourth blog in this blog series which I have called “Java & JDBC for Oracle DBAs”. Now we are finally ready to start to develop towards the Oracle database we created in part 1, and schemas we created in part 3.

Continue Reading »

Java and JDBC for Oracle DBAs – Part 3: Git, Oracle schemas and your first Java application

Finally we have come to the point where we start to create some Java code. First we’ll install Git, the most widely used modern version control system. We’ll continue to download some code from GitHub to create our Oracle schemas, and then we’ll create a very simple – but our first – Java application. We’ll test compiling and running our code both from Eclipse and from Maven. Finally we’ll extend our application to use the JDBC driver and connect towards our database and our new database schemas.

Continue Reading »