From 31ef7e5f7aaf38fc1a49f4ad95f76bd7969dfc3e Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 11 Aug 2010 20:37:49 +0000 Subject: [PATCH] HHH-5468 - Write a chapter about setting up database access git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@20134 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../en-US/Hibernate_Developer_Guide.xml | 1 + .../main/docbook/en-US/content/database.xml | 119 ++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 documentation/devguide/src/main/docbook/en-US/content/database.xml diff --git a/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml b/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml index 732074da4e..7370ec3293 100644 --- a/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml +++ b/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml @@ -10,5 +10,6 @@ --> + \ No newline at end of file diff --git a/documentation/devguide/src/main/docbook/en-US/content/database.xml b/documentation/devguide/src/main/docbook/en-US/content/database.xml new file mode 100644 index 0000000000..f4549875f4 --- /dev/null +++ b/documentation/devguide/src/main/docbook/en-US/content/database.xml @@ -0,0 +1,119 @@ + + + + + Database Access + +
+ JDBC Connections + + Hibernate understands how to connect to a database through an interface + org.hibernate.connection.ConnectionProvider. While + org.hibernate.connection.ConnectionProvider is considered an extension SPI, + Hibernate comes with a number of built-in providers. + + +
+ Using connection pooling + + + The built-in connection pooling based providers all require the following settings + + + + hibernate.connection.driver_class + + + Names the java.sql.Driver implementation class from your JDBC + provider. + + + + + hibernate.connection.url + + + The JDBC connection url. See your JDBC provider's documentation for details and examples. + + + + + hibernate.connection.username + + + The name of the user to use when opening a JDBC java.sql.Connection. + + + + + hibernate.connection.password + + + The password associated with the provided username. + + + + + +
+ Using Hibernate's built-in connection pooling + + + + The built-in Hibernate connection pool is not intended for production use. It lacks several + features found on any decent connection pool. However, it can be quite useful to get started + and in unit testing. + + + + + The only additional supported setting for the built-in pooling is the + hibernate.connection.pool_size setting which tells the pool how many + connections maximum it can keep in the pool. + +
+ +
+ Using c3p0 for connection pooling +
+ +
+ Using proxool for connection pooling +
+ +
+ +
+ Using <interfacename>javax.sql.DataSource</interfacename> + + + Hibernate can also use a javax.sql.DataSource to obtain + connections. To do so, Hibernate expects to be able to locate the + javax.sql.DataSource in JNDI. The + hibernate.connection.datasource setting tells Hibernate the JNDI + namespace at which it can find the the javax.sql.DataSource. + + + + Generally speaking a javax.sql.DataSource is configured to connect to + the database using a single set of credentials (username/password). Sometimes, however, the + javax.sql.DataSource is set up so that the credentials have to be + used to obtain a java.sql.Connection from it. In these cases + applications would specify the credentials via the hibernate.connection.username + and hibernate.connection.password settings, which Hibernate would pass along to the + javax.sql.DataSource when obtaining a + java.sql.Connection from it. + +
+ +
+ +
+ Database Dialects +
+ +
+ Database Schema +
+ +
\ No newline at end of file