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).
The files needed to be place there are:
Aegina is a small island located near Athens (Piraeus port). It is know as a resort for people living in Athens area, but not only. It combines beautiful scenery’s, and has lot of traditional buildings in the port. Also, for those who like to visit ancient temples, there is one in Aegina, in little mountain at an altitude of 160 meters, with a great view to the side of the island. Follows some photos from the port:
Most cities are beautiful in holidays. Because those days most people want to relax and spend their time without stress. Those days I like to take photos of the city I live in. To “capture” a different city. A city were people can really enjoy living in.
Aspropyrgos is a an Athens suburb. It’s near the sea, and it’s an industrial zone with big industries and many logistic companies operating on that region. But even in an industrial zone, there are some opportunities to take nice photos.
Those photos were taken in a village near Geneva, at the foot of the alps.
Photos of a colorful sunset in Dafni (Athens). No filters… Those are without any processing.
Kalamata is a seaside town located in Southwest in Peloponnese (Greece). It’s a really great place to visit as it combines mountains and sea, with great beaches. The city has a lot of traditional buildings and a castle with a panoramic view. Here a some photos…
This is a set of photos from my last visit to the Attica Zoological Park. It’s a private zoo located in an Athens suburb: Spata. The zoo is a home for a lot of animals, and in my opinion a place anyone visiting Athens should visit.
The park is open 365 days per year. It started as a bird park, but was expanded later and today you can see there almost 2000 animals representing almost 400 species. Bellow you can find more photos.
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
Some photos from Lamia. They were took on 17/4/2017. Continue reading