Solved

Image load to Sybase from JDBC

Posted on 1997-03-27
2
465 Views
Last Modified: 2008-03-06
Hey,

we're trying to store and retrieve GIF files to a Sybase System 11 server from (originally) disk files. We're using J++ as the development environment and WebLogic's JDBC driver as the interface.

We are having a problem where if a table has an image field in it, then JDBC cannot open the table.

What we want to know:

Is this a limitation of only the WebLogic driver, or do other JDBC drivers have the same problem?

If someone else has gotten the WebLogic driver to work, how? Could you provide us with the configuration information or sample code showing the retrieve?

Thanks
0
Comment
Question by:tharlan
2 Comments
 

Expert Comment

by:donnyt
ID: 1219288
We're not using WebLogic, but we're using Connect (http://www.connectsw.com).  For Sybase, you need to do something like:
      
      /*
      Setup connnections, try/catch, create Statement stmt,                   ResultSet rs, send SQL query and get ResultSet rs, etc..
      */
      ..

      InputStream is = rs.getBinaryStream(1);
      is.skip(2);      // For Sybase, skip 2 bytes for Images
      is.read(buffer, 0, imageSize);

      ..      
      /*  buffer is a byte[] array, imageSize is some number
          of bytes you want to read
      */

      Once image is in memory as byte[] (buffer, in the above             example), you can preprocess it and use MemoryImageSource
      to create an Image.
0
 
LVL 1

Accepted Solution

by:
trof earned 200 total points
ID: 1219289
JDBC does not implemented in J++ (yet). Do you use MS JDK 2.0 prerelease or just classes from Sun JDK , and what kind of JDBC driver (sorry I know nothing about WebLogic's)? If it's J++ & SunJDK  & JDBC/ODBC bridge - it definitely won't work - MS did not implement native methods calls properly(actually, they did not promice to do it). Try to use MS JDK 2.0, but remember, it's beta, so, nothing is garanteed. J++ and JDBC still don't like each other...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to use external config file with Spring MVC 4 59
powerN  challenge 3 47
mapShare challenge 13 68
word0 challenge 4 52
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now