Dot or Slash Separator On AS400 JDBC Resource

Recently I had to debug a Java web application and being new to the platform there were quite a few things I was unfamiliar with. One of those things was how to tell an AS400 resource whether it’s libraries and procedures were going to be separated by a slash or a dot. The application I was working on used slashes and apparently my connection’s default was dots. At first I changed all the calls but I always knew there had to be another way.

Here is how I specified what kind of naming the application should use on the server.xml file.

<Resource
  name="MyDataSource"
  auth="Container"
  type="javax.sql.DataSource"
  password="mypass"
  driverClassName="com.ibm.as400.access.AS400JDBCDriver"
  maxIdle="5"
  maxWait="5000"
  username="myuser" 
  url="jdbc:as400://AS400URL.COM; libraries= mylib, yourlib, theirlib; naming=system; prompt=false"
  maxActive="10"/>

Note the naming on the URL property.
“System” causes the connection to interpret the slash character as a separator.

naming=system

“Sql” causes the connection to interpret the dot character as a separator.

naming=sql