
Version 1.15
Last Modified: 25. Mar 2009
This is a documentation of the Sybase Server JDBC type 4 drivers Sytraks, Syto and Sybelux.
The zip file of the driver includes a jar file. The jar file is named like the driver (sytraks.jar, syto.jar or sybelux.jar). You need to add this jar file to your classpath or extract the jar file in the directory of the application.
Add the file Sybelux.jar to the Archive attribute of the applet tag, e.g.:
<APPLET CODE=”…” Codebase=”…” ARCHIVE=“Sybelux.jar” WIDTH=“100%” HEIGHT=“100%”>
…
</APPLET>
or extract the jar in the directory of the applet.
| Product | minimum JDK Version | JDBC Version |
| Sytraks | 1.2 | 2.0 |
| Syto | 1.2 | 2.0 + Optional Package |
| Sybelux | 1.4 | 3.0 |
All drivers support the following Server Versions:
This driver works with Sybase Servers that are configured to use the TCP/IP networking protocol. Please verify that your server is currently listening on a TCP/IP port. To make sure that the RDBMS server is listening on the machine name and port number you specified use:
telnet <hostname or ip address> <port number>
If the connection is refused, then the hostname or the port number are incorrect.
The class name of the driver is: com.inet.syb.SybDriver
The class name of the pooled driver is: com.inet.pool.PoolDriver
jdbc:inetsyb:hostname:portnumber
jdbc:inetsyb:hostname:portnumber?database=MyDb&language=deutsch → with properties
jdbc:inetsyb://servername/pipe/pipename → with named pipes
Example:
jdbc:inetsyb:www.inetsoftware.de:3333 jdbc:inetsyb:localHost:3433 jdbc:inetsyb://MyServer/pipe/sybase/query
| Name | Default | Description |
| host | localhost | the database host |
| port | 5000 | the port on which the server is listen |
| database | master | the name of the database |
| language | ”” | Sybase Server default language |
| user | - | the database user |
| password | - | password of the database user |
| charset | disabled | see Character Converting |
| nowarnings | false | If “true” the method 'getWarnings()' returns null |
| appname | - | Application name (only Application and Enterprise licenses) |
| useCursorsAlways | false | If “true” the method 'executeQuery' always uses server cursors |
| logging | false | If set to “true” the driver will write log to the “standard” output. |
| chained | false | If set to “true” the driver will change in the CHAINED MODE on autocommit = false. |
| loginTimeout | - | override the value from DriverManager.getLoginTimeout() |
| queryTimeout | 5 * loginTimeout | loginTimeoutSet the default query timeout for all Statements. |
| impltran | true | with Driver the default is “true” for compatibility with the JDBC-ODBC bridge. with DataSource the default is “false” to reduce deadlock problems If the value is true then the method setTransactionIsolation() will call setAutoCommit( false ) implicitly and start a transaction. |
There are two ways to put the properties to the driver:
There are seven examples included in the download zip file order.
ClassicDriver.javaAn example to demonstrate how to connect and use the driver with the JDBC 1.22 interface. (This driver requires the JDBC 2.0 interface and a JDK 1.2 or higher) PooledDriver.javaThis example shows the use of the PoolDriver. A driver with internal connection pooling.WithDataSource.javaHow to create a connection with a datasource.WithPoolDataSourece.javaHow to use the PooledConnection of the driver.WithPoolManager.javaThis demonstrates the use of the PoolManager i-net PLEXA™. i-net PLEXA™ is an example of a pool manager. i-net PLEXA™ comes with i-net SYBELUX™.WithCachedRowSet.javaHow to use the CachedRowSet from i-net software (i-net SYBELUX™).WithJDBCRowSet.javaHow to use the JDBCRowSet from i-net software (i-net SYBELUX™).
With the interface FailoverListener it is possible to manage the reconnection process. The FaloverListener receives an event if the Connection was broken, if the reconnection process was successful and if an error occured be the try of reconnect. In depend of the value returned from FailoverListener, a new try of reconnect will be started or not.
The Connection tryes to reconnect to the same server with the same properties. If reconnection was successful, all Statements, PreparedStatements and CallableStatements will be restored. The ResultSets won't be restored. For restore that, you have to executed the Statement again.
For more information see com.inet.pool.PoolManager.addFailoverListener(), com.inet.pool.FailoverListener, com.inet.pool.FailoverEvent and sample.MonitoredFailover.
There are multiple possibilities about how to configure the Monitored Failover. It is possible to use the default implementation of the FailoverListener or to use your own implementation. The default FailoverListener is similar to the TimedFailoverListener in the samples package. To every created Connection automatically an instance of the configured FailoverListener will be added.
Set a FailoverListener via Connection properties:
| name | default | description |
| useDefaultFailoverListener | false | if set on true, a default FailoverListener will be added automatically to every Connection |
| waitTimeToNextAttempt | 500 | property for the default FailoverListener. Sets the wait time in millis, that will be wait to the next reconnect attempt. |
| totalTimeOfAttempts | 30 | property for the default FailoverListener. Sets the total time in seconds, in that the reconnection process must be finished. |
| failoverListener | - | the class name of your own FailoverListener implentation. This class has to implement the FailoverListener interface AND the default public constructor. This is important to create a new instance of this class via reflection. |
Example URLs:
jdbc:inetpool:inetora:localhost?database=orcl&useDefaultFailoverListener=true&waitTimeToNextAttempt=100&totalTimeOfAttempts=10 jdbc:inetpool:inetora:localhost?database=orcl&failoverListener=test.MyFirtsFailoverListener
For more flexibility it is also possible to manage the registered FailoverListener of a Connection in Java. A FailoverListener can be only added to a Connection, that implements the interface TAFConnection. Those Connection can be received from:
The interface TAFConnection allows you to add and remove a FailoverListener to/from the Connection.
Example:
//receive a Connection Class.forName("com.inet.pool.PoolDriver"); Connection con = DriverManager.getConnection("jdbc:inetpool:inetora:localhost?database=orcl", "scott", "tiger"); //add a FailoverListener FailoverListener fl = new sample.MonitoredFailover.CounteredFailoverListener(99); ((TAFConnection)con).addFailoverListener(fl); //remove a FailoverListener ((TAFConnection)con).removeFailoverListener(fl); //remove all FailoverListener ((TAFConnection)con).removeAllFailoverListener(); //get all registered FailoverListener FailoverListener[] fls = getFailoverListener();
Another solution to connect to the Sybase Server are named pipes. Named pipes are working only in the Java VM 1.1.7 or higher and the Java VM 1.2Beta 4 or higher. Named pipes are equal to files with a UNC path. We have tested named pipes only with the Win32 VM from Sun. If you want to use named pipes from another platform you will need to install SMB (server message block) on the client or you will need to install NFS (network file system) on the Sybase Server.
The default pipe of the Sybase Server is ”/pipe/sybase/query” but you can change this pipe name in the server manager.
The driver implements the following escape clauses
Examples:
st = con.createStatement(); st.execute("{call MyProc('value')}"); pr = con.prepareStatement("{call MyProc('value')}"); pr.execute(); pr = con.prepareStatement("{call MyProc( ? )}"); pr.setString("value"); pr.execute();
interval may be one of the following:
SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, or SQL_TSI_YEAR
By default character converting is disabled. To use character converting in the driver you need to append “charset=YourCharSet” to the url.
Examples:
"jdbc:inetsyb:localhost:5000?charset=Cp1250"
"jdbc:inetsyb:localhost:5000?charset=" + sun.io.ByteToCharConverter.getDefault().getCharacterEncoding();
"jdbc:inetsyb:localhost:5000?charset=" + System.getProperty("file.encoding");
"jdbc:inetsyb:localhost:5000?charset=" + (new java.io.InputStreamReader(in)).getEncoding();
TIP: The property charset is case-sensitive in JAVA. The name of the character set is also case-sensitive.
You can test the availability of a character set with:
"test string".getBytes( charset );
If this line executes correctly the character set is available in the current VM.
Note: The UTF8 character set is required to store values into UNIVARCHAR and UNICHAR columns.
There is two ways to retrieve data from server:
The first method is effective for a not very large amount of data. In that case data will be complete cached on the client, that can cause out of memory problems. This method is used by the driver if there is no cursor (e.g. if the Result Set's type is TYPE_FORWARD_ONLY and the Result Set's concurrency is CONCUR_READ_ONLY and the flag useCursorsAlways is not set to “true”).
An another way is to use a cursor. A serverside cursor is generated if:
A cursor allows to fetch data from the server in blocks that is useful to receive a large amount of data. The number of rows that will be fetched from the database can be set with the method setFetchSize(). By default this value is 128. The fetch size can affect the performance. The “correct” value depends on the data types containing in the table and should be choose experimental for the best performance of your application.
Since Sybase Server doesn't support scrollable cursors the data is cached on the client for TYPE_SCROLL_SENSITIVE and TYPE_SCROLL_INSENSITIVE Result sets and therefore for a large amount of data is recommended to use Result set of type TYPE_FORWARD_ONLY.
If you have problems with the driver then you can enable the logging of the driver with:
DriverManager.setLogStream( System.out );
or
DriverManager.setLogWriter( new PrintWriter(System.out) );
You can also use any other PrintStream or PrintWriter to make this output. This can be used if you can not see the default PrintStreams (for example in a Servlet Engine or an Application Server).
PrintStream ps = new PrintStream( new FileOutputStream( "c:\\driver.log" ) ); DriverManager.setLogStream( ps );
If you have any problems then send an email providing as much information of what occured or happened as possible to <Sybase_driver>@inetsoftware.de where <Sybase_driver> is Sybelux, Syto or Sytraks.
You can find more info about our support at: http://www.inetsoftware.de/support/
Copyright by i-net software
More info and updates can be found at http://www.inetsoftware.de
© 2000-2009 i-net software