待辦事項 #15097

DB2 Error when creating Database Define
啟用日期: 2009-02-16 20:30 最後更新: 1970-01-01 09:00

回報者:
(匿名)
負責人:
(無)
類型:
狀態:
開啟
元件:
(無)
里程碑:
(無)
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
檔案:
1

細節

After having done wizard step "Setting of connection information" testing the connection succeeds. When pressing "Next" button the following exception shows up:

COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC-Treiber] CLI0611E Ungültiger Spaltenname. SQLSTATE=S0022
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.rsException(SQLExceptionGenerator.java:659)
at COM.ibm.db2.jdbc.app.DB2ResultSet.findColumn(DB2ResultSet.java:2839)
at COM.ibm.db2.jdbc.app.DB2ResultSet.getString(DB2ResultSet.java:2246)
at zigen.plugin.db.core.SchemaSearcher.execute(SchemaSearcher.java:60)
at zigen.plugin.db.ui.contentassist.ContentInfo.getSchemas(ContentInfo.java:118)
at zigen.plugin.db.ui.contentassist.ContentInfo.configure(ContentInfo.java:60)
at zigen.plugin.db.ui.contentassist.ContentInfo.<init>(ContentInfo.java:48)
at zigen.plugin.db.ui.contentassist.processor.SelectProcessor.createProposals(SelectProcessor.java:33)
at zigen.plugin.db.ui.contentassist.SQLContentAssistantProcessor2.computeCompletionProposals(SQLContentAssistantProcessor2.java:283)
at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1836)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:553)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:550)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:485)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:479)
at org.eclipse.jface.text.contentassist.ContentAssistant$2.run(ContentAssistant.java:377)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

my environment:
eclipse.buildId=M20080911-1700
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86 -clean

Executing SQL works fine. But the proposed DB Tree (e.g. http://www.ne.jp/asahi/zigen/home/plugin/dbviewer/images/eclipse3.4.gif) of my Database definition does not appear within the DB Tree View. Thus no schema and no table to be seen.

Ticket History (3/11 Histories)

2009-02-16 20:30 Updated by: None
  • File 3596: connected.jpg is attached
2009-02-16 23:40 Updated by: zigen
評語
To our regret, I cannot read German.

Can you solve it by the following means for solving the problems?

http://www.intuitio.de/?p=15#more-15
2009-02-17 00:20 Updated by: None
評語
Hi,

mea culpa. Just forget about the few german words.
The important thing are these international DB2 error codes: CLI0611E and SQLSTATE=S0022.

Here comes the english description of them:
~~~~~~~~~~~~~~~~~~snip
CLI0611E
Invalid column name.
Explanation:

The given column name cannot be found in the ResultSet.
User Response:

Ensure the column name is correct.
~~~~~~~~~~~~~~~~~~snip

So, the question is:
What is the default column used in the sql select statement when pressing "Next" button?
My guess, something similar to this "SELECT ${columnName} FROM ..." (unresolved variable) instead of "SELECT * FROM ...".

HTH. Regard,
Olaf
2009-02-17 22:03 Updated by: zigen
評語
Hi,

The part of the problem is getSchemas of not a usual SELECT sentence but DatabaseMetaData.


public static String[] execute(Connection con) throws Exception {
List list = new ArrayList();
ResultSet rs = null;
Statement st = null;
try {
DatabaseMetaData objMet = con.getMetaData();

if (!isSupport(con)) {
return new String[0];
}

list = new ArrayList();

if (DBType.getType(objMet) == DBType.DB_TYPE_MYSQL && objMet.getDatabaseMajorVersion() >= 5) {
String s = "SELECT SCHEMA_NAME AS TABLE_SCHEM FROM information_schema.SCHEMATA";
st = con.createStatement();
rs = st.executeQuery(s);
} else {
rs = objMet.getSchemas();
}

while (rs.next()) {
String wk = rs.getString("TABLE_SCHEM"); // <---------- Target!!
list.add(wk);
}


return (String[]) list.toArray(new String[0]);

} catch (Exception e) {
throw e;

} finally {
StatementUtil.close(st);
ResultSetUtil.close(rs);
}

}
2009-02-18 00:05 Updated by: None
評語
Hi and thx,

reading the list of schemas ("columns") is doing fine this way:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~snip
while (rs.next())
{
schemaName = rs.getString(1);
System.out.println("-> '" + schemaName+"'");
if (schemaName.equalsIgnoreCase("fooBar")) {
System.out.println("!!GOTCHA");
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~snip

but
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~snip
rs.getString("TABLE_SCHEM");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~snip
does not work because of buggy jdk 1.5.

do you plan a bugfix with above mentioned workaround ?

regards,
- olaf
2009-02-18 00:47 Updated by: zigen
評語
Thank you very much.

I corrected program.
Could you try it?
2009-02-18 00:49 Updated by: zigen
評語

http://www.ne.jp/asahi/zigen/home/plugin/dbviewer/plugins/zigen.plugin.db_1.1.0.v20090217.jar
2009-02-18 19:23 Updated by: None
評語
hi and thx for immediate support,

we are on the right track.

error CLI0611E and SQLSTATE=S0022 shows up when pressing "Test Connection" now :-(
Pressing "Next" in the wizard is fine: I can choose one ore more schemata :-))
Though, selected schemata are not displayed in DB Tree Viewer yet :-(

fancy another bugfix ?

regards,
- olaf
2009-02-18 23:07 Updated by: zigen
評語
The cause of the error in Test Connection has been understood.

However, is it a problem of JDBC Driver that Schema is not displayed in DB Tree Viewer ・・・?

In my DB2 environment (V8), it is possible to display it without trouble.

Can it be confirmed that the following methods become True?
--

public static boolean isSupport(Connection con) {
try {
DatabaseMetaData objMet = con.getMetaData();
return objMet.supportsSchemasInTableDefinitions();
} catch (Exception e) {
return false;
}
}

--
2009-02-19 19:15 Updated by: None
評語
hi,

do not shoot the messenger ;-)
but supportsSchemasInTableDefinitions() returns true.
application dbvisualizer is able to display the entire schema node collection using the fully equal driver (see attached screenshot). so we can finally exclude the driver as the cause of trouble.

i tried a couple of jdk running eclipse: sun1.5, ibm 1.5, sun1.6. the behaviour remains the same :-(

regards,
olaf
2009-02-19 19:21 Updated by: None
評語
unable to attach another picture.

Attachment File List

編輯

Please login to add comment to this ticket » 登入