Using the Eclipse Data Tools Platform with PowerBuilder and SQL Anywhere
Now a top-level project at eclipse.org
May. 29, 2008 08:15 AM
To learn more about DTP, resources can be found at http://wiki.eclipse.org/index.php/Data_Tools_Platform_Project.
SQL Anywhere is a suite of databases and data exchange technologies that pack a lot of power and performance into a small footprint. The SQL Anywhere Server database supports 32-bit and 64-bit servers on all major platforms. Many ISVs embed the SQL Anywhere Server database into their applications because not only can it scale from client/server environments with hundreds, even thousands, of users storing hundreds of gigabytes of data, but it can also be easily hidden in an application that runs on desktop and laptop computers requiring little or no IT support. You can learn more about SQL Anywhere by visiting www.ianywhere.com/sqlanywhere.
This tutorial shows you how to install the Data Tools Platform Eclipse plug-in and how to use some of its features against a SQL Anywhere 10 database.
• SQL Anywhere 10.0.1 or higher
• DTP 1.5M6 End-user or later
• Depending on what version of DTP you download, you will need specific versions of:
- Eclipse SDK. At the time this writing, Eclipse 3.2.2 SDK was required.
- EMF runtimes (EMF + SDO). At the time of this writing, EMF 2.2.2 (EMF +SDO) was required.
- GEF runtimes. At the time of this writing, GEF 3.2.2 was required.
• JRE 1.5 or higher
• Sybase jConnect 6.05 - available at www.sybase.com/products/allproductsa-z/softwaredeveloperkit/jconnect.
Before You Begin Downloading the Data Tools Platform
The first thing you need to do is download the DTP plug-in and include it in your Eclipse folder. You may also have to download the EMF and GEF plug-ins if you don't already have them. When you download and extract all the files, you have to merge them into your current Eclipse folder, where you typically launch the application. Here's a link where you can download DTP; it also has links to all of its dependencies (EMF and GEF): www.eclipse.org/datatools/down-loads.html.
Starting the Sample Database
This tutorial uses the sample database provided with the installation of SQL Anywhere. It's called demo.db and you can find it in the samples folder of your SQL Anywhere installation. If you're running on Mac OS X, Linux, or Unix, you'll need to configure the samples by sourcing the file 'samples/samples_config32.sh' from your SQLAnywhere 10 installation folder. If you're running on Windows, the samples folder is defined in the %SQLANYSAMP10% environment variable.
Stop all the databases running on your machine, find this file, change to its directory, and run the following command in a command prompt: dbeng10 demo.db.
This will start a database engine called 'demo', listening on port 2638 with one database called 'demo'.
Creating a Driver Template and Connection Profile
In this section we'll cover how to define a driver template and create a connection profile to be used to connect to our sample database.
1. In Eclipse, click 'File' | 'New' | 'Other' (see Figure 1)
2. Choose 'Connection Profile' (see Figure 2)
3. Click Next. Specify 'Sybase ASA' as the connection profile type (see Figure 3) (Note: The SQL Anywhere Server database was called ASA in previous versions of the product.)
4. Click Next. Give the connection profile a name, type 'sqlanywhere10' (see Figure 4)
5. Click Next. Here we have to choose a driver, but we have no driver templates defined. Click the browse button circled in the image below (see Figure 5)
6. Click 'Add' to add a new driver template (see Figure 6)
7. Choose the 'Sybase JDBC Driver for Sybase ASA 9.x (see Figure 7)
- Even though we're connecting to a SQL Anywhere 10 database, we can use this driver template and change the appropriate settings
- Change the driver name to 'Sybase JDBC Driver for SQL Anywhere 10.x'
- Make sure the 'Edit New Driver Definition Immediately' box is checked
8. After clicking 'OK,' press the 'Add Jar/Zip' button to browse for the jConnect 6.05 JAR file: jconn3.jar
9. Set the driver properties at the bottom of the screen as show in Figure 8
10. Click 'OK'
11. Now that we've defined a driver template, we can return to this screen, choose our new driver, and click 'OK' to continue (see Figure 9)
12. Set the connection profile settings as shown below and click 'Finish' (see Figure 10)
Now that we've created a connection profile, we can use the Data Source Explorer to connect to our sample database and view database objects in the object tree.
Connecting to SQL Anywhere 10
To connect to our SQL Anywhere sample database, we need to open the Data Source Explorer view.
1. Click 'Window' | 'Show View' | 'Other' (see Figure 11)
2. Choose 'Connectivity' | 'Data Source Explorer'
3. Click 'OK' (see Figure 12)
The Data Source Explorer initializes in your Eclipse environment. You can click and drag the title to dock it wherever you like.