Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for SFTP consists of three basic steps:
- Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
- Provide the driver class. For example:
cdata.jdbc.sftp.SFTPDriver
- Provide the JDBC URL. For example:
jdbc:sftp:RemoteHost=MySFTPServer; or jdbc:cdata:sftp:RemoteHost=MySFTPServer;
The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:sftp:" or "jdbc:cdata:sftp:" and can include any of the connection properties in name-value pairs separated with semicolons.
The CData JDBC Driver for SFTP allows connecting to SFTP servers.
Connecting to an SFTP Server
SFTP can be used to transfer files to and from SFTP servers using the SFTP Protocol. To connect, specify the RemoteHost. SFTP uses the User and Password and public key authentication (SSHClientCert). Choose an SSHAuthMode and specify connection values based on your selection.
Connecting to Data
Set the following connection properties to control the relational view of the file system:
- RemotePath: Set this to the current working directory.
- TableDepth: Set this to control the depth of subfolders to report as views.
- FileRetrievalDepth: Set this to retrieve files recursively and list them in the Root table.