To connect your Java application to a database and to open a database session, you can use thejava.sql.DriverManager.getConnection method of the Java platform. This method supplies a Connection object that is connected to the database.
You can find more detailed information in the documentation for the Java platform at http://java.sun.com
You have started the SAP MaxDB X Server (communication server).
More information: X Server, Starting the X Server
Note that you must start X Server even if the Java application and the database are located on the same computer.
You have loaded the JDBC driver.
More information: Loading the JDBC Driver
The java.sql.DriverManager.getConnection method has the mandatory parameter url (Connection URL) with the following connection options.
Option |
Default value |
Description |
---|---|---|
acceptServerCertificateAlways |
off |
Only for SSL connections Determines whether the database system checks if the SSL certificate of the database computer is contained in the list of the trusted certificates and whether it is still valid Possible values: off: The database system checks the SSL certificate. on: The database system does not check the SSL certificate. |
autocommit |
on |
AUTOCOMMIT mode on: The database system ends every SQL statement automatically with a COMMIT. off: You must end transactions explicitly with the commit () and rollback () methods. |
cache |
- |
Specifies for which SQL statements in Prepared Statements the JDBC driver saves information (for example, on the used parameters) in a dedicated cache Possible values: all: all SQL statements Combination of the following letters s (SELECT statements) i (INSERT statements) u (UPDATE statements) d (DELETE statements) Example cache=iud The database system saves information on INSERT, UPDATE and DELETE statements in the cache. End of the example. |
connectiontimeout |
0 |
Timeout for the connection (in milliseconds) The value 0 means that there is no timeout. |
connectiontrace |
- |
<file_name> Enables a connection trace for the current connection only. The trace is written to the file specified. |
currentschema |
- |
<schema_name> Sets the default schema for the database session If you do not specify this connection property, the current user's schema is used as default schema. |
defaultresultsettype |
- |
Default result set type |
ignoreHostNameInServerCert |
off |
Only for SSL connections Determines whether the database system compares the name of the database computer with the name specified in the SSL certificate Possible values: off: The database system compares the names. on: The database system does not compare the names. |
isolation |
- |
Isolation level for the connection You can specify the isolation level either as a character string or as an integer (depending how you have declared it in the java.sql.Connection class). You can enter the following character strings: TRANSACTION_READ_UNCOMMITTED | TRANSACTION_READ_COMMITTED | TRANSACTION_REPEATABLE_READ | TRANSACTION_SERIALIZABLE You can enter the following integer values: Concepts of the Database System, Isolation Level |
password |
- |
Password of the database user Caution Observe the use of upper and lower case, see Database Administration, Conventions for User Names and Passwords. End of the caution. |
reconnect |
on |
RECONNECT mode Possible values: on: The system automatically reconnects to the database instance after a command timeout. off: There is no automatic new connection. |
sqlmode |
INTERNAL |
SQL mode ORACLE | INTERNAL |
timeout |
- |
Timeout for the database session (in seconds) If you specify this connection option, you override the timeout that has been configured for the database with the special database parameter SessionTimeout (see Database Administration, Special Database Parameters). |
trace |
- |
<directory>/<jdbc_trace_file> If you specify this connection option, then the database system writes a JDBC trace in the <jdbc_trace_file> file in the directory <directory>. |
tracesize |
- |
Maximum number of lines in the JDBC trace file. If this number of lines is exceeded, the database system begins to overwrite the content of the JDBC trace file |
transport |
socket |
Communication method for communicating with the DBM server Possible values: socket: TCP/IP connection secure: SSL connection, see Setting Up an SSL Connection |
unicode |
false |
When you specify this connection option, the JDBC driver sends the user name, password and SQL statements in Unicode to the database. |
user |
- |
Name of the database user |