Java DB

Apache Derby

Derby Developer's Guide

Derby Getting Started
Derby Reference Manual
Derby Developer's Guide
Derby Performance Tuning
Derby Server and Admin Guide
Derby Tools and Utilities
Derby Developer's Guide
-After installing
-Upgrades
-JDBC applications and Derby basics
-Application development overview
-Derby embedded basics
-Derby JDBC driver
-Derby JDBC database connection URL
-Derby system
-A Derby database
-Connecting to databases
-Working with the database connection URL attributes
-Using in-memory databases
-Working with Derby properties
-Deploying Derby applications
-Deployment issues
-Creating Derby databases for read-only use
-Loading classes from a database
-Derby server-side programming
-Programming database-side JDBC routines
-Programming trigger actions
-Programming Derby-style table functions
-Programming user-defined types
-Controlling Derby application behavior
-The JDBC connection and transaction model
-Result set and cursor mechanisms
-Locking, concurrency, and isolation
-Working with multiple connections to a single database
-Working with multiple threads sharing a single connection
-Working with database threads in an embedded environment
-Working with Derby SQLExceptions in an application
-Using Derby as a J2EE resource manager
-Derby and Security
-Configuring security for your environment
-Working with user authentication
-Users and authorization identifiers
-User authorizations
-Encrypting databases on disk
-Signed jar files
-Notes on the Derby security features
-User authentication and authorization examples
-Running Derby under a security manager
-Developing tools and using Derby with an IDE
-SQL tips
-Localizing Derby
-Derby and standards

 

Database connection examples

The examples in this section use the syntax of the connection URL for use in an embedded environment.

This information also applies to the client connection URL in a client/server environment. For reference information about client connection URLs, see "java.sql.Connection interface" in the Derby Reference Manual.

  • jdbc:derby:db1

    Open a connection to the database db1. db1 is a directory located in the system directory.

  • jdbc:derby:london/sales

    Open a connection to the database london/sales. london is a subdirectory of the system directory, and sales is a subdirectory of the directory london.

  • jdbc:derby:/reference/phrases/french

    Open a connection to the database /reference/phrases/french.

    On a UNIX system, this would be the path of the directory. On a Windows system, the path would be C:\reference\phrases\french if the current drive were C. If a jar file storing databases were in the user's classpath, this could also be a path within the jar file.

  • jdbc:derby:a:/demo/sample

    Open a connection to the database stored in the directory \demo\sample on drive A (usually the floppy drive) on a Windows system.

  • jdbc:derby:c:/databases/salesdb jdbc:derby:salesdb

    These two connection URLs connect to the same database, salesdb, on a Windows platform if the system directory of the Derby system is C:\databases.

  • jdbc:derby:support/bugsdb;create=true

    Create the database support/bugsdb in the system directory, automatically creating the intermediate directory support if it does not exist.

  • jdbc:derby:sample;shutdown=true

    Shut down the sample database. (Authentication is not enabled, so no user credentials are required.)

  • jdbc:derby:/myDB

    Access myDB (which is directly in a directory in the classpath) as a read-only database.

  • jdbc:derby:memory:myDB

    Access the in-memory database named myDB. The syntax for a client connection URL is different; see Using in-memory databases for details.

  • jdbc:derby:classpath:/myDB

    Access myDB (which is directly in a directory in the classpath) as a read-only database. The reason for using the subsubprotocol is that it might have the same path as a database in the directory structure.

  • jdbc:derby:jar:(C:/dbs.jar)products/boiledfood

    Access the read-only database boiledfood in the products directory from the jar file C:/dbs.jar.

  • jdbc:derby:directory:myDB

    Access myDB, which is in the system directory. The reason for using the directory: subsubprotocol is that it might happen to have the same path as a database in the classpath.

 

javadb@jdbcurl.com