• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC with database specific calls

 
Lu Battist
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a query that involves database specific functions for sybase.
One of them is getDate(). When I ran it on WIN-NT through Sun's jdbc-odbc bridge driver it worked like a charm. Now I have to port it to a unix based platform and will need to use J-connect (Sybase's driver) and with this driver the code is blowing up on the functions.
I tried the escape method. {fn getDate()} But it still doesn't work.
I get the following error message:
java.sql.SQLException: JZ0SI: A static function escape getdate was used which is not supported by this server.
Does anyone know of another trick that might work?
 
Tommy Braas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would appear that the getDate() function is supported by the ODBC driver for SyBase, and not by the database itself. What exactly do you need the call for?
 
Lu Battist
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response. Are you sure the getDate is not valid for the database? I'm pretty sure this is Sysbase's way of getting the current date. Maybe it just that the its not supported through JDBC.
It is used to get a requested deliverly date (if there is one) from a column in a table, otherwise grab the current date from the database. I'm sure if I poke around in the manuals I'll find some way to take care of this.
I have other concerns though with two more functions: stuff and patindex.
When I fix the getDate() one, I expect to have a similar problem with stuff and patindex. I hope I'm wrong. (It removes unwanted junk from some part numbers.) I've shown the select column below:
isNull({fn stuff(OLI.part_number, {fn patindex(\"%-PPR\",OLI.part_number)}+
{fn patindex(\"%-TRAN\",OLI.part_number)} ,255,\"\")},OLI.part_number) as partNum
 
Lu Battist
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone help me understand.
sql1 = "select getDate()";
sql2 = "select {fn getDate()}";
sql1 works great and reutrns the current database timestamp.
sql2 Returns: java.sql.SQLException: JZ0SI: A static function escape getdate was used which is not supported by this server.
Why does sql2 fail? I thought using the function escape was a way to pass database specfic commands. What is the purpose the function escape?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic