Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-225

limit cause `getString` from int column error.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.3.0, 1.3.2, 1.3.1
    • 1.3.3
    • Other

    Description

      import java.sql.*;
      import org.junit.Assert;
      import org.junit.Test;

      public class Main {

      @Test
      public void test() throws ClassNotFoundException, SQLException {
      Class.forName("org.mariadb.jdbc.Driver");
      try (Connection connection = DriverManager.getConnection("jdbc:mariadb://localhost/test", "root", "root")) {
      try {
      connection.prepareStatement("CREATE TABLE table1(column1 int)").execute();
      connection.prepareStatement("INSERT INTO table1(column1) VALUES (2)").execute();
      try (PreparedStatement ps = connection.prepareStatement("select column1 from table1 limit ?")) {
      ps.setInt(1, 20);
      ResultSet rs = ps.executeQuery();
      while (rs.next())

      { Assert.assertEquals("2", rs.getString("column1")); }

      }
      } finally

      { connection.prepareStatement("drop table table1").execute(); }

      }
      }

      }

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              zhanhb zhanhb
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.