Solved

Image load to Sybase from JDBC

Posted on 1997-03-27
2
470 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

919 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

18 Experts available now in Live!

Get 1:1 Help Now