Db: 3.60:need Classpath For Mac

Here we will learn how to use SQLite in JAVA programming language to connect SQLite database, Table, and operations on SQLite tables using JDBC driver with examples. SQLite in JAVA Interface We can easily interact with SQLite in JAVA language using JDBC driver. This JDBC driver is known as SQLite-JDBC package which contains both JAVA classes and SQLite libraries to perform different operations like connect to database, create tables, insert data in tables, etc.

On windows, linux and Mac OS platform. Before we proceed to interact with SQLite using JAVA language first we need to make sure that JAVA setup available in our PC. In case if JAVA setup is not available means follow Java Tutorial for JAVA installation. If JAVA setup available in our PC, now we will install SQLite-JDBC driver for that download latest JDBC driver sqlite-jdbc-version.jar from available list of drivers. Now we need to add downloaded JDBC driver jar file ( sqlite-jdbc-version.jar) to our classpath like shown in our following programs.

Connect to SQLite Database using Java Now we will connect to SQLite database using JAVA if exists otherwise it will create new database and then connect to it. Following is the JAVA program which is used to connect a database if exist otherwise first it will create database and then connect to it. Select DML Operation For Product Table. Exit Enter a choice: 1 Enter Product Name: Pencil Enter Product Price: 5 Enter Product Quantity: 50 Inserted Successfully!!! Continue Y OR N? Y Select DML Operation For Product Table. Exit Enter a choice: 4 ID Name Price Qty - - - - 1 Pencil 5.0 50 Continue Y OR N?

Y Select DML Operation For Product Table. Exit Enter a choice: 2 Enter Product id: 1 Enter Product Name: Sharpner Enter Product Price: 10 Enter Product Quantity: 90 Updated Successfully!!! Continue Y OR N?

Db: 3.60:need Classpath For Mac Os

Db: 3.60:need classpath for mac mac

Y Select DML Operation For Product Table. Exit Enter a choice: 4 ID Name Price Qty - - - - 1 Sharpner 10.0 90 Continue Y OR N? Y Select DML Operation For Product Table.

Exit Enter a choice: 1 Enter Product Name: Scale Enter Product Price: 5 Enter Product Quantity: 60 Inserted Successfully!!! Continue Y OR N? Y Select DML Operation For Product Table.

Exit Enter a choice: 4 ID Name Price Qty - - - - 1 Sharpner 10.0 90 2 Scale 5.0 60 Continue Y OR N? Y Select DML Operation For Product Table. Exit Enter a choice: 3 Enter Product id: 2 Deleted Successfully!!! Continue Y OR N? Y Select DML Operation For Product Table. Exit Enter a choice: 4 ID Name Price Qty - - - - 1 Sharpner 10.0 90 Continue Y OR N? N This is how we can use SQLite database in JAVA to perform, and operations based on our requirements.

Purpose The purpose of this page is to discuss using Xcode and JDBC with SQL Anywhere on Mac OS X. Overview This tutorial walks you through the creation of a simple Cocoa application with Xcode on Mac OS X. The application queries the Contact table of the Adaptive Server Anywhere sample database (asademo.db). It provides the ability to move through the contact table with a bi-directional cursor and save changes to Street and ZIP data.

The tutorial does not teach JDBC or Java programming. There are many resources available on the web to assist you with these topics. Instead, it assists you in building an Xcode Cocoa Java project by putting together the required components within the IDE. This tutorial is divided into two sections: one for using the iAnywhere JDBC driver, and one for using jConnect. In each section, instructions are provided for two versions of this tutorial: a quick start version that allows you to run the project right away, and a step-by-step version that takes you through the steps for creating a new Cocoa project. Requirements. SQL Anywhere Studio 9.0.1 for Mac OS X or later.

MAC OS X 10.3 or later. Xcode version 1.1 Choosing a JDBC Driver Adaptive Server Anywhere provides two JDBC drivers.

Choose which one you wish to use in your application. iAnywhere JDBC Driver: This is a type 2 driver. It provides better performance than jConnect, but is not a pure Java driver.

This driver is recommended for most applications that do not require a pure Java solution. jConnect: This is a type 4 pure Java driver and is recommended if you require a pure Java solution. Building a Cocoa Project that Uses the iAnywhere JDBC Driver Creating an ODBC Data Source If you are using the iAnywhere JDBC driver, before you start the tutorials you must create an ODBC data source in order to connect to the Adaptive Server Anywhere sample database (asademo.db). The sample application relies on a data source named ASATutorial. The following instructions explain how to create this data source using an ODBC Administrator. Before you can create an ODBC data source, you must first add the Adaptive Server Anywhere ODBC driver.

If you have already done this, proceed to the steps on creating an ODBC data source. Note: This document assumes you have installed SQL Anywhere Studio in the default directory ( /Applications/SQLAnywhere16) To Add the Adaptive Server Anywhere ODBC Driver.

Db: 3.60:need Classpath For Mac Free

Launch the ODBC Administrator from /Applications/Utilities. Select the Drivers tab. In the Description field, type ASA 9.0 Driver. Click Browse and select the Adaptive Server Anywhere ODBC driver in both the Driver File Name and Setup File Name fields. By default, it is located in /Applications/SQLAnywhere9/System/lib/dbodbc9r.bundle.

Once you have added the Adaptive Server Anywhere ODBC driver, you can create an ODBC data source that will be used to connect to the database. To Create an ODBC Data Source.

Launch the ODBC Administrator from /Applications/Utilities. The following figure illustrates the ODBC Administrator:. In the ODBC Administrator, click the User DSN tab and then click Add. Choose the Adaptive Server Anywhere 9.0 driver from the list of available drivers. Type ASATutorial in the Data Source Name field and add the following connection parameters, as shown below. The connection parameters and values are case insensitive. Keyword Value UID dba PWD sql START dbeng9 DBF /Applications/SQLAnywhere9/System/asademo.db ThreadManager ON.

Click OK. Click Apply. Press Comand + Q to exit the ODBC Administrator.

Alternatively, you can add the information with a text editor. The ODBC configuration files are located in /Library/ODBC within your Home directory. There is an odbcinst.ini file for driver information and an odbc.ini file for data source information. IAnywhere JDBC Driver Quick Start The quick start version of the tutorial allows you to see the finished project before you complete the step-by-step tutorial. Open the Finder and navigate to /Applications/SQLAnywhere9/samples/asa/CocoaJava/ContactSample/JDBC.

Copy the QuickStart directory to a temporary location, such as your Home directory. Open the QuickStart directory in the new location and double-click ContactSample.xcode.

In Xcode, in the Groups and Files pane, expand Executables and then double-click ContactSample. Click + under the Environment Variables heading and add the following environment variables, as shown below. Environment Variable Value DYLDLIBRARYPATH /Applications/SQLAnywhere9/System/lib CLASSPATH /Applications/SQLAnywhere9/System/java/jodbc.jar The DYLDLIBRARYPATH environment variable is used to locate the native libraries, while CLASSPATH environment variable is used to locate the Java classes.

Buidling and Running the Project. From the Build menu, choose Build and Go to start the application.

Click Connect. The Contact Management application appears: Tutorial: Building a Cocoa Project that Uses jConnect Adaptive Server Anywhere includes a quick start version of this tutorial that allows you to see the finished project before you complete the step-by-step tutorial, or you can proceed directly to the step-by-step tutorial if you wish. Note: This document assumes you have installed SQL Anywhere Studio in the default directory ( /Applications/SQLAnywhere9). JConnect Quick Start The quick start version of this tutorial allows you to see the finished project before you complete the step-by-step tutorial. To Run the Quick Start Version of the jConnect Tutorial.

Open the Finder and navigate to /Applications/SQLAnywhere9/samples/asa/CocoaJava/ContactSample/jConnect. Copy the QuickStart directory to a temporary location, such as your Home directory. Open the QuickStart directory in the new location and double-click ContactSample.xcode. Pre-start the database server. In the Finder, navigate to /Applications/SQLAnywhere9. Double-click DBLauncher.

When you are prompted for server options, type the following in the Database text box: /Applications/SQLAnywhere9/System/asademo.db. Click the Build and Go button or press Command+R to run the project.

3.60:needDb:

The Contact Management application appears. Click Connect to connect the sample application to the database. Building a Cocoa Project that Uses jConnect This tutorial shows you how to create a Cocoa project that accesses the Adaptive Server Anywhere sample database using jConnect. The complete code for this project is located in /Applications/SQLAnywhere9/samples/asa/CocoaJava/ContactSample/jConnect. Creating a New Cocoa Java Project. Start Xcode. In the Finder, go to /Developer/Applications/Xcode and then double-click Xcode.

Create a new project. From the Xcode File menu, choose New Project. The New Project dialog appears. Choose Application  Cocoa-Java Application. Type ContactSampleJava as the name of the project and save it in the /ContactSampleJava/jConnect directory as shown below.

Click Finish. Adding Classes to the Project. In the Finder, drag and drop the JDBCController.java file (located in /Applications/SQLAnywhere9/samples/asa/CocoaJava/ContactSample/Tutorial/src) into the Classes group in the left pane of Xcode. When prompted, select the Copy Items into Destination Group’s Folder option and then click Add. Edit the code to use jConnect. Search the code for 1) to find the jConnect entries and uncomment them.

There are two lines for jConnect and they should appear as follows once you have uncommented them: String connStr = 'jdbc:sybase:Tds:localhost:2638'. Class.forName( 'com.sybase.jdbc2.jdbc.SybDriver' ); Note: The project files installed with Adaptive Server Anywhere are read-only. Xcode will prompt you when you edit the file.

Click Edit Anyway when Xcode prompts you. Save the project. Adding the UI to the Project The files provided for this tutorial include a UI for the sample application that you can drag and drop into the project from the Finder. In the Finder, navigate to /Applications/SQLAnywhere9/samples/asa/CocoaJava/ContactSample/Tutorial/src, Option-click the directory English.lproj, and then drag and drop it into your local copy of the ContactSampleJava project in the Finder. When you are prompted, choose to replace the existing files.

In Xcode, save the project. Adding the JDBC Driver to the Project. In the left pane of Xcode, expand the ContactSample group. In the left pane, select the Resources group. From the Xcode Project menu, choose Add Files.

A new Finder window appears. In the Finder, select /Applications/SQLAnywhere9/System/shared/jConnect-55/classes/jconn2.jar from your SQL Anywhere installation and click Add. Click Add to add the JDBC driver to the target. Save the project. Configuring the Target.

In the left pane of Xcode, expand the Targets group. Double-click ContactSampleJava. In the left pane of the new window, expand Build Phases. In the left pane, double-click Frameworks & Libraries.

In the right pane, select the Merge option for the jconn2.jar file as follows: Building and Running the Project. Pre-start the database server. In the Finder, navigate to /Applications/SQLAnywhere9. Double-click DBLauncher. When you are prompted for server options, type the following in the Database text box: /Applications/SQLAnywhere9/System/asademo.db. Click the Build and Go button or press Command+R to run the project. The Contact Management application appears.

Click Connect to connect the sample application to the database. Related Content Related Documents Related SAP Notes/KBAs.

Comments are closed.