BEA Logo BEA WebLogic Server Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

Technical FAQ: Questions about jdbcKona/Sybase

FAQ Index

Problems with jdbcKona/Sybase on UNIX using native threads

Q I'm using jdbcKona/Sybase on Solaris with native threads, and there seem to be some problems with using concurrent multiple Statements. Is there a workaround?

A We have determined from customer reports and internal testing that jdbcKona/Sybase does not work on native UNIX threads due to underlying problems with DB-LIB. The general solution is to use jdbcKona/Sybase with green threads.

On Solaris, however, there is a workaround: native threads will work if the first database connection is made in the main thread. Then all other connections will work in other threads.

Top of the page

Character set incompatibilities when using Solaris Sybase server

Q We're using jdbcKona/Sybase 3.0.4 with Sybase 11.5 (Adaptive Server Enterprise). All of our database work is in US English, but we're getting an error message that says:

Cannot find the requested character set in Syscharsets: name = 'cp850'
Why does WebLogic require the CP850 character set? How can I avoid receiving these error messages?

A It's not WebLogic that requires the CP850 character set, it is the underlying DB-LIB library from Sybase that we use to implement the driver that is causing the problem. There are slight incompatibilities between the default character sets installed on the Solaris Sybase server and those expected by DB-LIB client libraries on other platforms. This generates a fatal Sybase error upon connecting at the DB-LIB level. In WebLogic 3.0.4 our driver handles Sybase fatal errors such as this by throwing a SQLException and returning null as the Connection. (This default behavior was changed in a later version.)

There are two ways you can avoid these error messages:

  1. Install the CP850 codeset in your Sybase server.

    or

  2. Upgrade to the WebLogic version 3.1.7 or later. The more recent version does not throw an exception about the missing CP850 character set and allows the connection to be made. The error information is still available by using the java.sql.Connection.getWarnings() method.

Top of the page

Does jdbcKona/Sybase work with Sybase SQL Server 4.9x?

A Because Sybase SQL Server 4.9x was developed before the ODBC, SQL-89, and and SQL-2 standards, it does not support some key features required under JavaSoft's JDBC specification. WebLogic does not officially support SQL Server 4.9x, but some of our customers who are familiar with SQL Server 4.9x report success in using jdbcKona/Sybase for their SQL Server 4.9x applications.

WebLogic is aware of the following incompatibilities:

  • Methods from the DatabaseMetaData class that return ResultSets do not work.
  • Autocommit cannot be set to false. This is fundamental to the way that SQL Server 4.9x handles transactions. You must wrap multistatement transactions in SQL "BEGIN TRANSACTION" and "COMMIT TRANSACTION".
  • Many of the standard SQL keywords are not recognized by 4.9x. For example, the integer datatype can only be described with the keyword 'int'. You cannot use 'INT', 'integer', or 'INTEGER'.
  • The Numeric datatype is not supported.
  • Operations on Text/Image data types using SQL queries are more limited than with newer versions Sybase SQL Server.

Top of the page

Why do I get an Exception when I call getTimestamp()?

Q I'm using jdbcKona/Sybase and JDK 1.0.2. I am calling a stored procedure that returns the timestamp as a column in a row result. I want to pass this timestamp back to a stored proc to use in a database compare. When I try to use the getTimestamp() method, I get a SQLException. Is there some way to read and pass back the timestamp without having to use string conversions?

A The problem is that the JDBC term Timestamp and the SQL Server term Timestamp have two completely different meanings. In JDBC, Timestamp is a data type for the storage of absolute or relative time values, analogous to the Datetime data type in SQL Server. In SQL Server, however, Timestamp is a binary value that describes when an object (usually a data page) was last modified.

If you want to select or update a SQL Server Timestamp, treat it as a Java byte[8] array and use one of the JDBC getBytes() methods to access it.

Note that you also need to upgrade to the latest version of JDK 1.1. WebLogic is no longer supported under JDK 1.0.2.

Top of the page

Why is the "time" part of the date missing?

Q I'm returning a date from a database without error, but the "time" portion of it seems to be missing, for example, I get back "Mon Aug 26 00:00:00 1996". The data in the database has hour, minute, second, and millisecond information.

A If you are using asDate() to retrieve the date data, this returns a java.sql.Date object, which doesn't include hh:mm:ss information. Try using the asTimeStamp() method instead (in the JDBC meaning of Timestamp, not the Sybase meaning.)

Top of the page

Can I turn off autocommit in my jdbcKona/Sybase application?

Q I want to turn off autocommit in my jdbcKona/Sybase application to perform several stored procedure calls within a single transaction. When I turn off autocommit, however, jdbcKona/Sybase raises an Exception when I try to get the return values of the individual stored procs.

A Turning off autocommit causes SQL Server to go into "chained" mode, which may have non-intuitive and sometimes unpredictable results, especially with stored procedures that were either not designed for use with chained mode, or were defined when chained mode was not on.

Before you adjust autocommit, you should read the topic "Autocommit" in the Developers guide for jdbcKona/Sybase and jdbcKona/MSSQLServer. You should also read the discussions about chained mode and about transactions in stored procedures in section 3 of the SQL Server Reference Manual, "Transactions."

Top of the page

Problems inserting data with jdbcKona/Sybase

Q I'm using jdbcKona/Sybase to insert some records. I'm getting the following error when I try to execute the insert statement:

  java.sql.SQLException: Length 2107 Exceeds the SQL Server limit of 255

A The data you are trying to save is longer than 255 bytes. There are two SQL Server types (Text and Image) that support data longer than 255 bytes, but there are no methods in the current JDBC spec that support updates to columns of the corresponding JDBC data types (Longvarchar and Longvarbinary).

Being able to update Longvarchar and Longvarbinary columns is valuable enough that we have supplied a public method for it that is not part of the JDBC API. You can read the details and see a code example in the jdbcKona/Sybase notes in the Developers guide for jdbcKona/Sybase and jdbcKona/MSSQLServer.

If this feature is important to your project, please contact jdbc@wombat.eng.sun.com and ask that it be added to future revisions of the JDBC spec.

Top of the page

How do I get primary key information from a Sybase table?

Q I'm using Connection.getPrimaryKeys() to retrieve primary key information from some Sybase tables. I get back a ResultSet, but no data is in it, that is, the column headings are correct, but there are no rows in the results.

A For Sybase System 10 and 11 and for Microsoft SQL Server, getPrimaryKeys() works if you created the table with a primary key integrity constraint, for example:

  "create table tprimary (a int, b int, primary key(a,b))"
If you do not create the table this way, there is no way with SQL Server to determine the primary key.

In addition, getPrimaryKeys() is not implemented for Sybase 4.9x.

Top of the page

How does jdbcKona/Sybase handle trailing spaces?

Q I've noticed that jdbcKona/Sybase doesn't handle trailing spaces like the C language DB-LIB interface I use. DB-LIB trims off trailing spaces in char fields, but jdbcKona/Sybase does not. Why is the behavior different?

A We call "dbconvert" in DB-LIB with the -2 length flag, which does not trim any trailing spaces. We considered using the -1 length flag, which trims all the leading and trailing spaces, but that would produce a null field if the field was all spaces. We decided that passing the field exactly as you provide it was a good compromise. You can trim char fields programmatically if you do not want trailing spaces.

Top of the page

Using a JIT with HPUX and jdbcKona/Sybase

Q I am using your Sybase drivers on a HPUX platform and getting a segfault error. What is going wrong?

A There are problems using the jdbcKona/Sybase drivers on the HP platform with the JavaSoft JIT (just-in-time compiler). If you invoke Java using -nojit on the command line you will not have this problem.

Here is an example for starting a program that has two initial arguments:

 $ java -nojit myProgram myArgument1 myArgument2

Running your program this way will solve the problem.

 

Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
Last updated 04/01/1999