Try OpenEdge Now
skip to main content
SQL Development
JDBC Client : Connecting to an OpenEdge database with a JDBC driver : Connecting using SQL Explorer
 

Connecting using SQL Explorer

SQL Explorer is a Java-based tool you can use to execute OpenEdge SQL statements, shell commands, and client control commands. All the properties of the SQL Explorer are stored in the SQLexplorer.properties file.
To start the SQL Explorer tool and connect to an OpenEdge database, execute a command using one of the following syntax examples:
sqlexp -db database-name -S port |service-name -H host -user userid -password password
sqlexp -url jdbc:datadirect:openedge://host:port;databaseName=db_name;
servicename=service_name -user userid -password password
The following examples show how to connect using a blank password:
sqlexp -char -db sports2000 -S port -infile CreateView.sql -outfile CreateView.out -user userid -password \'\'
sqlexp -char -db sports2000 -S port -infile SelectView.sql -outfile SelectView.out -user userid -password \'\'
Once the SQL Explorer is terminated, the SQLexplorer.properties file is updated with the latest configuration properties and the last used JDBC URL. The properties can be changed by connecting to the database using SQL Explorer and using the command @<command>. For example, to set the AutoCommit property to False.
SQLExplorer>@AutoCommit false
You can also edit the SQLProperties file using a text editor. To see the list of all the properties, use the command @ and for information on these commands and the possible values, use the command @Help. The following table lists the command line arguments and their description:
Table 2. Command line arguments
Command Line argument
Mandatory/Optional
Comments
-user <user>
Optional
The default value is the current user name.
-password <passwd>
Optional
The default value is the current user password.
-url <url>
Mandatory
The URL option maybe specified in place of the -db, -S and the -H options. The URL should be of this format: jdbc:datadirect:openedge://<host>:<port>;databaseName=<dbname> or jdbc:datadirect:openedge://<host>:-1;databaseName=<dbname>;serviceName=<service>
-db <database>
Mandatory
This option need not precede the database specification option.
-S <service|port>
Mandatory
Service name or port number may be specified as an argument to the -S option.
-H <host>
Optional
The default entry for this argument is localhost.
-driverUrl <url>
Mandatory
The format of the URL should be "jdbc:datadirect:openedge://<host>:<port>;databaseName=<dbName>;User=<user>;Password=<password>". The driverUrl must be enclosed in quotes. All fields listed above must be present. In addition, driver connection parameters can also be added to the url. For example, SSL options are now driver connection parameters. To enable encryption without authentication, the -driverUrl option should be as follows: "jdbc:datadirect:openedge://<host>:<port>;databaseName=<dbName>;User=<user>;Password=<password;EncryptionMethod=ssl;validateServerCertificate=false"
-infile <infile>
Optional
This option is used in character mode only. The SQL Explorer executes the commands in the input file and terminates.
-outfile <outfile>
Optional
This option is used in character mode only. Redirects SQL command output from standard output to named file.
-command <command>
Optional
This option is used in character mode only. The SQL Explorer executes the specified SQL command then terminates.
-sqlverbose
Optional
This option is used in character mode only. Beginning and ending time stamps are printed along with number of rows and columns fetched, and the fetch limit.

Notes

*The -db preceding the database-name is optional. host is optional and defaults to localhost, which is valid only for non-remote databases.
*The user is optional and defaults to the current user. The user's password is also optional and defaults to null.
*In Windows and on UNIX, a user and password are optional until the first user is created in the OpenEdge database.
*You can use an encrypted password. Follow the procedure for generating and using encrypted passwords in the Password(-P) section of OpenEdge Deployment: Startup Command and Parameter Reference.
*Once the CREATE USER statement is executed, a user and password must be provided.