Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Washington, DC
    Posts
    2

    Unanswered: Problem with WHERE clause when column length > 255

    Hello, I am using the JDCB-ODBC driver for my app, but one of the columns in my WHERE clause is 255 characters long. Because of this no rows are returned even though the statement should return 1 or 2 rows. I've tried other JDBC-ODBC drivers too and they have the same problem. Additionally, I've tried using RTrim(), Substring(), etc and it still will not work....any ideas? Is it a driver bug? Anyone know of a driver that will work?

    Sample code....

    ResultSet rs = dbRetrieve.getStatement().executeQuery( sql ) ;
    if (rs.next()) {
    // Never gets here
    }

    Thanx!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Have you run the query (verbatim) in Microsoft Query Analyzer and seen the rows returned?

    -PatP

  3. #3
    Join Date
    Mar 2004
    Location
    Washington, DC
    Posts
    2
    Originally posted by Pat Phelan
    Have you run the query (verbatim) in Microsoft Query Analyzer and seen the rows returned?

    -PatP

    Yes, I have and it returns results. Additionally, I've removed the column from the where clause in my java file and it returns data, but of course its uselys because I need that column in the where clause....

    Thanks...

  4. #4
    Join Date
    Sep 2003
    Posts
    364
    Hmm... Microsoft's JDBC driver says it will support upt to 4000 character strings. Have you used profiler to see exactly what's being sent to your SQL server?

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Since the SQL code works ok from Query Analyzer, we can assume that SQL Server to the MDAC on your client works fine. The problem must be in the JDBC driver or beyond it.

    Which JDBC driver are you using? Does it have any length limitations that you are aware of (or does it keep them as surprises for the unwary)? As Peter pointed out, the Microsoft JDBC driver handles big strings (I've run 2 Kb columns out through it).

    Just as another thought, are you certain that your Java app is behaving and actually submitting what you expect it to.

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •