- This topic has 7 replies, 2 voices, and was last updated 18 years, 1 month ago by Haris Peco.
-
AuthorPosts
-
Claus NielsenMemberThe Database Explorer can connect to an iSeries database.
I can open an SQL editor, execute SQL statements and have the results displayed.
I can use the new table wizard to create new tables.The DB Browser views displays all the iSeries libraries (aka schemas), but not the tables in them.
What I really need is the Hibernate reverse engineering support, which, as I understand it, should be available in the context menu for tables displayed in the DB Browser.
As long as the DB Browser dosn’t display any tables, I don’t see any way to have hibernate mappings generated for my tables – is there some other way?The following error is logged when I try to view tables:
Error
Tue Sep 26 12:55:18 CEST 2006
Error getting table informationjava.sql.SQLException: [SQL0901] SQL system error.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
at com.ibm.as400.access.AS400JDBCDatabaseMetaData.getTables(AS400JDBCDatabaseMetaData.java:4170)
at net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData.getTables(SQLDatabaseMetaData.java:603)
at com.genuitec.eclipse.sqlexplorer.model.TableObjectTypeNode.loadTables(TableObjectTypeNode.java:143)
at com.genuitec.eclipse.sqlexplorer.model.TableObjectTypeNode.getChildren(TableObjectTypeNode.java:202)
at com.genuitec.eclipse.sqlexplorer.views.DatabaseContentProvider.getChildren(DatabaseContentProvider.java:71)
at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren(AbstractTreeViewer.java:1157)
at org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeViewer.java:768)
at org.eclipse.jface.viewers.AbstractTreeViewer.getFilteredChildren(AbstractTreeViewer.java:565)
at org.eclipse.jface.viewers.AbstractTreeViewer.getSortedChildren(AbstractTreeViewer.java:534)
at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:719)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:696)
at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:892)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:1240)
at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:1252)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:181)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:6254)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:3794)
at org.eclipse.swt.widgets.Composite.WM_NOTIFY(Composite.java:1166)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3298)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1842)
at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1319)
at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:5171)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3279)
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:4768)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1923)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)It probably dosn’t help you much, but I also found this on the iSeries machine:
Meddelelse . . : Attributes of value number 2 in field HVR0002 not
valid.Cause . . . . . : Either the type, length, decimal digits, decimal
precision, or CCSID (Coded Character Set Identifier) of value number 2 for
variable field HVR0002 in query record format FORMAT0001 is not valid.
See the DDS Reference topic in the Information Center book,
http://www.ibm.com/eserver/iseries/infocenter, for valid field attributes.and:
Meddelelse . . : SQL system error.
Cause . . . . . : An SQL system error has occurred. The current SQL
statement cannot be completed successfully. The error will not prevent
other SQL statements from being processed. Previous messages may indicate
that there is a problem with the SQL statement and SQL did not correctly
diagnose the error. The previous message identifier was CPD4392. Internal
error type 3105 has occurred. If precompiling, processing will not continue
beyond this statement.
Recovery . . . : See the previous messages to determine if there is a
problem with the SQL statement. To view the messages, use the DSPJOBLOG
command if running interactively, or the WRKJOB command to view the output
of a precompile. An application program receiving this return code may
attempt further SQL statements. Correct any errors and try the request
again.
Haris PecoMemberclanie,
This error is from your jdbc driver.MyEclipse call table list with standard JDBC’s getTables method – jdbc driver create sql (or what ever) and return table data .
if you see your log you will see that error is in
com.ibm.as400.access.AS400JDBCDatabaseMetaData.getTablesthis is jdbc driver call.
You can try use other jdbc driver (if it exists) or newer version this driver.Try this test as well :
import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; public class TestTables { private static String driverName = "YOUR_CLASSNAME"; private static String url = "YOUR URL"; private static String username = "YOUR_USERNAME"; private static String password = "YOUR_PASSWORD"; public static void main(String[] args) { try { Class.forName(driverName); Connection connection = DriverManager.getConnection(url, username, password); DatabaseMetaData md = connection.getMetaData(); // you can change first argument with your catalog (if database support catalog) // and second with schema ResultSet tables = md.getTables(null, null, "%", new String[] { "TABLE","VIEW" }); while (tables.next()) { String table = tables.getString("TABLE_NAME"); System.out.println("table=" + table); } } catch (Exception e) { e.printStackTrace(); } } }
Best
Peco
Claus NielsenMemberI tried the test and it ran just fine with this driverName and URL:
driverName = “com.ibm.as400.access.AS400JDBCDriver”;
url = “jdbc:as400://bontcp;translate binary=true;naming=sql”;The JDBC driver is from JTOpen 5.2.
It’s the newest version, and I don’t know of any other drivers for iSeries. Do you know of anyone who has this working with an iSeries (DB2/400) database – with this or some other JDBC driver?
Haris PecoMemberclanie,
try change getTables method and add your schema name from dbexplorer , for example :
ResultSet tables = md.getTables(null, “ADMIN”, “%”, new String[] { “TABLE”,”VIEW” });
ADMIN is schema name or what ever you have in db explorer
driver claim problem for 2nd parameter and it is probably schema name.
We have not testing environment for iSeries (DB2/400) database.Sorry
Best
Peco
Claus NielsenMemberActually already tried that, and the test runs just fine both with and without a schema name specified.
Kind regards
Claus
Haris PecoMembersorry, but can you try with nonexisting schema, for example ‘nonexist’ (lower case)
and … have you same credentials (url, username and password) when do this test and try form MyEclipse ?
Thanks
Peco
Claus NielsenMemberWith a nonexisting schema name the test still runs, but nothing is printed, of course.
Yes, I use the same credentials for the test as in the database explorer.
Haris PecoMemberMyEclipse send exactly this call to jdbc – It is strange
Please send your eclipse, java and Myeclipse version
Thanks
-
AuthorPosts