You use the method java.sql.DriverManager.getConnection to connect to the database instance. You use the url parameter in this method to specify the name of the database computer and the database instance.
Define the connection URL. Use the following format:
jdbc:sapdb://<database_server>[:<port>]/<database_name>[<options>]
Parameter |
Description |
database_server |
Name of the database computer |
port |
Socket port to which you want to connect |
database_name |
Name of the database instance |
options |
Definition of the parameter url for a connection to the database TST on the computer REMOTESERVER
jdbc:sapdb:// REMOTESERVER/TST
Definition of the parameter url for a connection to the database TST on the remote computer REMOTESERVER using the port 9876. (This definition requires the X Server to be configured with the same port.)
jdbc:sapdb://servermachine:9876/TST
Definition of the parameter url for a connection to the database TST on the local computer
jdbc:sapdb:///TST
Definition of the parameter url for a connection to the database TST on the local computer; the SQL mode is ORACLE and a command timeout of 120 seconds is defined:
jdbc:sapdb:///TST?sqlmode=ORACLE&timeout=120:
See also:
Examples for Connecting to the Database