B4J Connection to a SAP ASE Database…

In a previous post (B4J Connection to Database Example…) I demonstrated through a very simple application how to connect within a B4J application to a SAP SQL Anywhere Database. It’s not always easy to find how we can connect to a database. This is because, when connecting to a database using JDBC, we have to know which driver we will use and also the required JDBC URL to communicate with the database server. This information isn’t always easy to find, as they are different versions of clients, and each database client may have different driver & settings!

As mentioned in the title, this time I will give an example of a connection to a SAP ASE Database. Currently, I will be testing the connectivity to versions 15.7 and 16.0 of the product. As with any database, the first thing we need to check is that the JDBC driver option of the client was checked and installed during client’s installation (this can be done through control panel add/remove programs option). The second is to copy two files to out Additional  Libraries folder (this path is declared in B4J IDE as shown in the following screenshot).

AdditionalLibs

The files needed to be place there are:

  1. jconn4.jar
  2. jTDS3.jar

Continue reading

B4J Connection to Database Example…

In this post we will see a Database Connection example in B4J. The database we will use is SQL Anywhere 16 (Developer Edition). So we need to have installed SQL Anywhere 16 (Developer Edition) to our computer.

First thing we must have in mind is that B4J produces java code. To connect to a database we need to have a JDBC driver. SQL Anywhere does provide a JDBC driver (sajdbc4.jar). To use it in B4J we have to copy the sajdbc4.jar & jodbc4.jar to our additional libraries folder. Those files are provided with SQL Anywhere client installation.

If all steps mentioned before are done, then we are ready to write our first application in B4J to connect and query a SQL Anywhere Database. For the purpose of our example we will use the sample database provided with SQL Anywhere 16. Continue reading