Re: Error when comparing against empty string using JDBC 2005 Beta



You can track the bug here:
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=e749c179-1463-42bf-9e51-9751beea14fa

If you are not sure that this bug references the specific problem that you
are encountering I would be happy to work with you to verify this
--
Angel Saenz-Badillos [MS] DataWorks
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging: http://weblogs.asp.net/angelsb/




"jgarza" <jgarza@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1925CBE1-CE14-4550-8698-191A1052A9F6@xxxxxxxxxxxxxxxx
>
> Is there a BugID # for us to track and escalate purposes. We are part of
> BetaOne MS partners
>
> "Kamil Sykora [MSFT]" wrote:
>
>> Hello,
>>
>> This does indeed look like the same issue that was posted on 11/28. I
>> filed
>> a bug on that issue and I added this case to the bug as well.
>>
>> Thanks,
>> Kamil
>>
>> Kamil Sykora [MSFT]
>> Microsoft Developer Support - Webdata
>>
>> This posting is provided "AS IS", with no warranties, and confers no
>> rights.
>>
>> Please do not send email directly to this alias. This alias is for
>> newsgroup
>> purposes only.
>> --------------------
>> | Thread-Topic: Error when comparing against empty string using JDBC 2005
>> Beta 2
>> | From: =?Utf-8?B?amdhcnph?= <jgarza@xxxxxxxxxxxxxxxxxxxxxxxxx>
>> | Subject: RE: Error when comparing against empty string using JDBC 2005
>> Beta 2
>> | Date: Fri, 2 Dec 2005 13:21:02 -0800
>> |
>> |
>> | By the way if you change the empty string '' with something like 'xxx',
>> JDBC
>> | would not end up with the problem. That is why I am indicating that
>> this
>> is a
>> | problem when comparing an empty string. It is like JDBC decided to
>> truncate
>> | my query at the empty string location.
>> |
>> | "jgarza" wrote:
>> |
>> | > I am having a problem with JDBC 2005 Beta when comparing against an
>> empty
>> | > string.
>> | > tate : S1093
>> | > Message: Index out of range1 Valid range is 1 to 0
>> | > Error : 0
>> | > com.microsoft.sqlserver.jdbc.SQLServerException: Index out of range1
>> Valid
>> | > range is 1 to 0
>> | > at
>> | >
>> com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown
>> | > Source)
>> | > at com.microsoft.sqlserver.jdbc.SQLServerStatement.setParam(Unknown
>> Source)
>> | > at
>> | >
>> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setString(Unknown
>> | > Source)
>> | > at com.acornsys.mmjavaapi.MsJdbc2005Bug.main(MsJdbc2005Bug.java:46)
>> | > ====
>> | >
>> | > Here is a code sample to reproduce the bug
>> | >
>> | > /*
>> | > * MS JDBC Driver Beta 2 has problem when performing
>> | > * something like col = ''
>> | > *
>> | > * CREATE TABLE dbo.mytable (
>> | > * table_id INT NOT NULL,
>> | > * table_name VARCHAR(128) NOT NULL
>> | > * )
>> | > */
>> | > package com.sample.bug;
>> | >
>> | > import java.sql.Connection;
>> | > import java.sql.PreparedStatement;
>> | > import java.sql.ResultSet;
>> | > import java.sql.SQLException;
>> | >
>> | > public class MsJdbc2005Bug
>> | > {
>> | > public static void main(String args[])
>> | > {
>> | > try {
>> | >
>> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
>> | > } catch(java.lang.ClassNotFoundException e) {
>> | > System.out.println("Unable to load Driver class");
>> | > return;
>> | > }
>> | >
>> | > Connection conn = null;
>> | > PreparedStatement pstmt = null;
>> | > ResultSet rSet = null;
>> | >
>> | > try {
>> | > String
>> dbUrl="jdbc:sqlserver://deathstar;databaseName=JORGE_BUG";
>> | > String user = "sa";
>> | > String password = "acorn";
>> | >
>> | > String query = ("SELECT COUNT(*) FROM mytable"
>> | > + " WHERE table_name <> ''"
>> | > + " AND table_name <> ? "
>> | > + " AND table_id = ?");
>> | >
>> | > conn = java.sql.DriverManager.getConnection(dbUrl, user,
>> | > password);
>> | > pstmt = conn.prepareStatement(query);
>> | >
>> | > //IT will FAIL here....
>> | > pstmt.setString(1, "xxxx");
>> | > pstmt.setInt(2, 0);
>> | >
>> | > rSet = pstmt.executeQuery();
>> | > while (rSet.next()) {
>> | > System.out.println(rSet.getInt(1));
>> | > }
>> | > } catch (SQLException e) {
>> | >
>> | > // Loop through the SQL Exceptions
>> | > SQLException e2 = e;
>> | >
>> | > while(e2 != null) {
>> | > System.out.println("State : " + e2.getSQLState()) ;
>> | > System.out.println("Message: " + e2.getMessage()) ;
>> | > System.out.println("Error : " + e2.getErrorCode()) ;
>> | >
>> | > e2 = e2.getNextException() ;
>> | > }
>> | > e.printStackTrace();
>> | > } catch(Exception e) {
>> | > System.out.println(e) ;
>> | > e.printStackTrace();
>> | > } finally {
>> | > try {
>> | > if (rSet != null)
>> | > rSet.close();
>> | > if (pstmt != null)
>> | > pstmt.close();
>> | > if (conn != null)
>> | > conn.close();
>> | > } catch (Exception e) {}
>> | > }
>> | > }
>> | > }
>> | >
>> | >
>> | >
>> | >
>> | >
>> |
>>
>>


.



Relevant Pages

  • Re: Can not get updates
    ... Hello Alias ... I regularly clean up my computer before updating. ... A bug is something that does not work ... that should work for hundreds of different installations is quite a challenge ...
    (microsoft.public.windowsupdate)
  • Re: maximum driver handles per process?
    ... Please do not send e-mail directly to this alias. ... but there is a good chance that it lies with synchronization). ... the problem may lie with some bug in IRP_MJ_CREATE ... I'm using Win2k, WinXP, Win03. ...
    (microsoft.public.development.device.drivers)
  • Re: 2005 drivers dont like my select statement
    ... To make sure it gets routed correctly it would also help if you placed "JDBC ... This alias is for newsgroup purposes only. ... > This posting is provided "AS IS", with no warranties, and confers no ... >>> entered a bug so that we can take a look at this asap. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Behavior of Connection.commit()
    ... Jerry, ... very comprehensive testing framework, if you are interested we would be ... This alias is for newsgroup purposes only. ... > bug. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Where do you report a bug?
    ... what's the bug? ... Please do not send e-mail directly to this alias. ... Beste Grüsse / Best regards / Votre bien devoue ... Microsoft Live Space: http://kerem-g.spaces.live.com/ ...
    (microsoft.public.win32.programmer.kernel)

Loading