0% found this document useful (0 votes)
46 views3 pages

Derby-Database: Notice That Multiple Entries in The Class Path Are Separated by A Semicolon ( ) On Windows

The document provides steps to install and configure Derby, an open source relational database, including: 1) Copying Derby files to the desired folder location, setting the DERBY_INSTALL variable to this location. 2) Configuring the CLASSPATH to include necessary Derby JAR files like derby.jar for the engine and driver. 3) Running setEmbeddedCP.bat to set the CLASSPATH for embedded Derby usage and testing installation using sysinfo.

Uploaded by

mayank_gits
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views3 pages

Derby-Database: Notice That Multiple Entries in The Class Path Are Separated by A Semicolon ( ) On Windows

The document provides steps to install and configure Derby, an open source relational database, including: 1) Copying Derby files to the desired folder location, setting the DERBY_INSTALL variable to this location. 2) Configuring the CLASSPATH to include necessary Derby JAR files like derby.jar for the engine and driver. 3) Running setEmbeddedCP.bat to set the CLASSPATH for embedded Derby usage and testing installation using sysinfo.

Uploaded by

mayank_gits
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

DERBY-DataBase

Installation of Derby
Step1: copy db-derby-10.9.1.0-bin folder in C:\apache-tomcat-7.0.19
Step 2: Set DERBY_INSTALL variable to the location as follows
C:\> set DERBY_INSTALL=C:\Apache\db-derby-10.9.1.0-bin
Step 3: Configure Embedded Derby
To use Derby in its embedded mode set our CLASSPATH to include the jar
files listed below:

derby.jar: contains the Derby engine and the Derby Embedded JDBC
driver

derbytools.jar: optional, provides the ij tool


We can set our CLASSPATH explicitly with the command shown below:
C:\>set CLASSPATH==%DERBY_INSTALL%\lib\derby.jar;%
DERBY_INSTALL%\lib\ derbytools.jar;

Notice that multiple entries in the class path are separated by a semicolon
(;) on Windows
Step 4: The setEmbeddedCP.bat scripts use the DERBY_INSTALL variable to
set the CLASSPATH for Derby embedded usage.
C:\> cd %DERBY_INSTALL%\bin
C:\> Apache\db-derby-10.9.1.0-bin\bin> setEmbeddedCP.bat
Step 5: Run the sysinfo command, as shown below, to output Derby system
information:
java org.apache.derby.tools.sysinfo
Step 6:Successful output will look something like this:
------------------ Java Information -----------------Java Version: 1.6.0_31
Java Vendor:
Apple Inc.
Java home:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Java classpath: /Users/myself/src:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derby.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derby.war:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_cs.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_de_DE.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_es.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_fr.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0-

bin/lib/derbyLocale_hu.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_it.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_ja_JP.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_ko_KR.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_pl.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_pt_BR.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_ru.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_zh_CN.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyLocale_zh_TW.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyclient.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbynet.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0bin/lib/derbyrun.jar:/Users/myself/derby/10.9.1/db-derby-10.9.1.0-bin/lib/derbytools.jar
OS name:
Mac OS X
OS architecture: x86_64
OS version:
10.7.4
Java user name: myself
Java user home: /Users/myself
Java user dir: /Users/myself/derby/mainline
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
java.runtime.version: 1.6.0_31-b04-415-11M3646
--------- Derby Information -------[/Users/myself/derby/10.9.1/db-derby-10.9.1.0-bin/lib/derby.jar] 10.9.1.0 - (1344872)
[/Users/myself/derby/10.9.1/db-derby-10.9.1.0-bin/lib/derbytools.jar] 10.9.1.0 (1344872)
[/Users/myself/derby/10.9.1/db-derby-10.9.1.0-bin/lib/derbynet.jar] 10.9.1.0 - (1344872)
[/Users/myself/derby/10.9.1/db-derby-10.9.1.0-bin/lib/derbyclient.jar] 10.9.1.0 (1344872)
---------------------------------------------------------------------- Locale Information ----------------Current Locale : [English/United States [en_US]]
Found support for locale: [cs]
version: 10.9.1.0 - (1344872)
Found support for locale: [de_DE]
version: 10.9.1.0 - (1344872)
Found support for locale: [es]
version: 10.9.1.0 - (1344872)
Found support for locale: [fr]
version: 10.9.1.0 - (1344872)
Found support for locale: [hu]
version: 10.9.1.0 - (1344872)
Found support for locale: [it]
version: 10.9.1.0 - (1344872)
Found support for locale: [ja_JP]
version: 10.9.1.0 - (1344872)
Found support for locale: [ko_KR]
version: 10.9.1.0 - (1344872)
Found support for locale: [pl]
version: 10.9.1.0 - (1344872)
Found support for locale: [pt_BR]
version: 10.9.1.0 - (1344872)
Found support for locale: [ru]
version: 10.9.1.0 - (1344872)
Found support for locale: [zh_CN]
version: 10.9.1.0 - (1344872)
Found support for locale: [zh_TW]
version: 10.9.1.0 - (1344872)
------------------------------------------------------

Derby Example
import
import
import
import
import

java.sql.Connection;
java.sql.DriverManager;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.sql.Statement;

public class fderby


{
static Connection conn;
public static void main(String[] args) throws Exception
{
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
String dbName = "AddressBookDB";
String connectionURL = "jdbc:derby:" + dbName + ";create=true";
String createString = "CREATE TABLE ADDRESSBOOKTbl (NAME VARCHAR(32)
NOT NULL, ADDRESS VARCHAR(50) NOT NULL)";
Class.forName(driver);
conn = DriverManager.getConnection(connectionURL);
Statement stmt = conn.createStatement();
stmt.executeUpdate(createString);
PreparedStatement psInsert = conn.prepareStatement("insert into
ADDRESSBOOKTbl values (?,?)");
psInsert.setString(1, "Name");
psInsert.setString(2, "Address");
psInsert.executeUpdate();
Statement stmt2 = conn.createStatement();
ResultSet rs = stmt2.executeQuery("select * from ADDRESSBOOKTbl");
System.out.println("Addressed present in your Address Book\n\n");
int num = 0;
while (rs.next())
{
System.out.println(++num + ": Name: " + rs.getString(1) + "\n
Address"+ rs.getString(2));
}
rs.close();
}
}

You might also like