The code for Connect2DB subroutine will be the following: Sub Connect2DB() We have two buttons, named ButtonExit & ButtonRetrieve and a TableView named TableViewQueryResult, in our case. Our applications will contain the following subroutines:Īlso it will contains a basic form with two buttons and a TableView (see screenshot bellow): For the purpose of our example we will use the sample database provided with SQL Anywhere 16. 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. Those files are provided with SQL Anywhere client installation. To use it in B4J we have to copy the sajdbc4.jar & jodbc4.jar to our additional libraries folder. SQL Anywhere does provide a JDBC driver (sajdbc4.jar). To connect to a database we need to have a JDBC driver. So we need to have installed SQL Anywhere 16 (Developer Edition) to our computer.įirst thing we must have in mind is that B4J produces java code. The database we will use is SQL Anywhere 16 (Developer Edition). In this post we will see a Database Connection example in B4J.
0 Comments
Leave a Reply. |