You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michael Akerman (JIRA)" <ji...@apache.org> on 2011/07/14 22:19:00 UTC

[jira] [Created] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

"drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
----------------------------------------------------------------------------------------------------------------------------------

                 Key: DBUTILS-77
                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
             Project: Commons DbUtils
          Issue Type: Bug
    Affects Versions: 1.3
         Environment: Java environment: Java 6 on Redhat Linux
Database enviroment: SQLServer 2008

            Reporter: Michael Akerman
             Fix For: 1.4




--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "William R. Speirs (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

William R. Speirs updated DBUTILS-77:
-------------------------------------

    Attachment: DBUTILS-77v1.diff

Updated documentation to better explain what the pmdKnownBroken parameter does
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>         Attachments: DBUTILS-77v1.diff
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "William R. Speirs (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

William R. Speirs closed DBUTILS-77.
------------------------------------

    Resolution: Invalid

Documentation change submitted in r1204562.
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>         Attachments: DBUTILS-77v1.diff
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072629#comment-13072629 ] 

William R. Speirs commented on DBUTILS-77:
------------------------------------------

Are you seeing any exceptions?

> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.4
>
>


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "William R. Speirs (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149730#comment-13149730 ] 

William R. Speirs commented on DBUTILS-77:
------------------------------------------

Agreed, the documentation should be updated to better explain what the "workaround" is actually doing, and that other JDBC Drivers might want to use it as well.

I wouldn't rush to add that line to AbstractQueryRunner however. If you have a bad SQL statement, you'll be turning off the use of getParameterMetaData() when it might actually be useful with later requests.

I'd propose only an update to documentation for this one...
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Michael Akerman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149692#comment-13149692 ] 

Michael Akerman commented on DBUTILS-77:
----------------------------------------

Here's the code that fails to run the SQL for me:

			final QueryRunner qr = new QueryRunner();
			final int rows = qr.update( con, sql, args );
			return rows;

Here's code that works:
			final PreparedStatement psm = con.prepareStatement( sql );
			for ( int i=1; i <= args.length; i++ )
			{
				psm.setString( i, args[i].toString() );
			}
			int rows = psm.executeUpdate();
			psm.close();
			return rows;
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Michael Akerman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149698#comment-13149698 ] 

Michael Akerman commented on DBUTILS-77:
----------------------------------------

The first stack trace was from the 1.2 version.  Here's the stack trace from 1.4.

Exception in thread "main" java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Unable to identify the table drop view sqlapps.rso_current_person for the metadata. Query: drop view sqlapps.rso_current_person Parameters: []
        at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:320)
        at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:489)
        at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:402)
        at edu.uark.util.ConnectionUtils.execute(ConnectionUtils.java:64)
        at edu.uark.util.queryrunner.Main.main(Main.java:64)

                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Michael Akerman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149690#comment-13149690 ] 

Michael Akerman commented on DBUTILS-77:
----------------------------------------

Yes, sorry there was an exception:

Exception in thread "main" java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Unable to identify the table drop view sqlapps.rso_current_person for the metadata. Query: drop view sqlapps.rso_current_person Parameters: []
        at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:540)
        at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:597)

                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Michael Akerman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149673#comment-13149673 ] 

Michael Akerman commented on DBUTILS-77:
----------------------------------------

Yes, I'll recreate it and see what I can report.  I don't recall exceptions, I think it was an error code.
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Michael Akerman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149726#comment-13149726 ] 

Michael Akerman commented on DBUTILS-77:
----------------------------------------

			final QueryRunner qr = new QueryRunner(true);

Solves the problem.  However this doesn't match the documentation of what that feature is meant for.

Also, I think we might need:
catch (SQLException e) {
                            pmdKnownBroken = true;
                       }

In AbstractQueryRunner.java somewhere around line 172.
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Henri Yandell (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147953#comment-13147953 ] 

Henri Yandell commented on DBUTILS-77:
--------------------------------------

Seems like a great one to get released in the next one. Michael - are you still around and able to provide any more info?
                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "Michael Akerman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149705#comment-13149705 ] 

Michael Akerman commented on DBUTILS-77:
----------------------------------------

Here is the inner SQLException:
com.microsoft.sqlserver.jdbc.SQLServerException: com.microsoft.sqlserver.jdbc.SQLServerException: Unable to identify the table drop view sqlapps.rso_current_person for the metadata.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
	at com.microsoft.sqlserver.jdbc.SQLServerParameterMetaData.(SQLServerParameterMetaData.java:426)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getParameterMetaData(SQLServerPreparedStatement.java:1510)
	at org.apache.commons.dbutils.AbstractQueryRunner.fillStatement(AbstractQueryRunner.java:172)
	at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:485)
	at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:402)
	at edu.uark.util.ConnectionUtils.execute(ConnectionUtils.java:66)
	at edu.uark.util.queryrunner.Main.main(Main.java:64)

                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-77) "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine.

Posted by "William R. Speirs (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149718#comment-13149718 ] 

William R. Speirs commented on DBUTILS-77:
------------------------------------------

Michael, can you try it again but construct QueryRunner as follows: QueryRunner(true);

The line which is causing the exception is an attempt to get meta data: stmt.getParameterMetaData(); using the QueryRunner(true) constructor will prevent this code from being run. Thanks...

                
> "drop view" does not work from QueryRunner.update with SQLServer JDBC drivers.  Same SQL works with a PreparedStatement just fine.
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-77
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-77
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Java environment: Java 6 on Redhat Linux
> Database enviroment: SQLServer 2008
>            Reporter: Michael Akerman
>             Fix For: 1.5
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira