Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application, based on CData JDBC Driver for Sybase.Follow these steps:
- Add the driver JAR file to the classpath. The JAR file is located in the installation directory's lib subfolder. Ensure that the .lic file is located in the same folder as the JAR file.
- Provide the driver class. For example:
cdata.jdbc.sybase.SybaseDriver
- Provide the JDBC URL. For example:
jdbc:sybase:user=myuser;password=mypassword;Server=localhost;Database=Northwind
Or, if there is a conflict in your application between drivers using the same URL format, use this form to ensure that you are using the CData driver:
jdbc:cdata:sybase:user=myuser;password=mypassword;Server=localhost;Database=Northwind
Ensure that the URL starts with either jdbc:sybase: or jdbc:cdata:sybase:. The URL can include any of the connection properties in name-value pairs separated with semicolons.
Connecting to Sybase
To connect to the Sybase, specify the following connection properties:
- Server: Set this to the name or network address of the Sybase database instance.
- Database: Set this to the name of the Sybase database running on the specified Server.
Optionally, you can also secure your connections with TLS/SSL by setting UseSSL to true.
Authenticating to Sybase
Sybase supports several methods for authentication including Password and Kerberos.
Password
Set the AuthScheme to Password and set the following connection properties to use Sybase authentication.
- User: Set this to the username of the authenticating Sybase user.
- Password: Set this to the username of the authenticating Sybase user.
Kerberos
To leverage Kerberos authentication, begin by enabling it via the following connection property:
- AuthScheme: Set to Kerberos will be used for authentication to Sybase.
You can find an example connection string below:
Server=MyServer;Port=MyPort;User=SampleUser;Password=SamplePassword;Database=MyDB;Kerberos=true;KerberosKDC=MyKDC;KerberosRealm=MYREALM.COM;KerberosSPN=server-name