Here is my code:

Connection igniteJdbcConnection =
DriverManager.getConnection("jdbc:ignite:cfg://streaming=true:cache=am_jdbc@file:/E:/ignite-jdbc.xml");

PreparedStatement igniteInsertPrepareStatement =
igniteJdbcConnection.prepareStatement("insert into Sample_Superstore(Row_ID,
...");

Above prepareStatement throw
org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to
set schema for DB connection for thread [schema=].



The following is my observation during debug.
-----------------------------------------------
    /**
     * JdbcConnection.prepareNativeStatement
     */
    PreparedStatement prepareNativeStatement(String sql) throws SQLException
{
        return
ignite().context().query().prepareNativeStatement(schemaName(), sql);
    }
-----------------------------------------CALL the following
method----------------------------------
    /**
     *
     * GridQueryProcessor.prepareNativeStatement
     */
    public PreparedStatement prepareNativeStatement(String cacheName, String
sql) throws SQLException {
        checkxEnabled();

        String schemaName = idx.schema(cacheName);

        return idx.prepareNativeStatement(schemaName, sql);
    }

Right now, parameter - cacheName is "PUBLIC" during runtime.

--------------------------------------------CALL following
method---------------

    /** {@inheritDoc} */
    @Override  public String schema(String cacheName) {
        String res = cacheName2schema.get(cacheName);

        if (res == null)
            res = "";

        return res;
    }

Now cacheName2schema has this value - {SQL_PUBLIC_SAMPLE_SUPERSTORE=PUBLIC,
ignite-sys-cache=ignite-sys-cache, am_jdbc=PUBLIC}.

I think problem is that my prepareStatement carries "PUBLIC" as a cache
name. 

Thank you so much!

James





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to