Discussion:
[Middlegen-user] Re: Middlegen and DB2/400
Aslak Hellesøy
2003-07-10 19:35:14 UTC
Permalink
I forwarde this to the user mailing list. 100eds of others might be
interested or able to help too :-)
I am trying to use the Middlegen with DB2/400.
I see in "Supported Databases" that DB2/400 have "Untested Status", but
i go to try...
I have one little program that connect to db2/400 with success.
This program connect's to AS400 using JTOPEN driver (class
select * from gxdtacv.vcc001. (The program is annexed above.)
gxdtacv is a library of DB2/400, and vcc001 is a table inside of this
library.
Obviously, i was trying create/configure the db2400.xml with the same
JDBC driver, URL, user and password...
Do you know where i put the library ?
I trying database.schema, database.catalog, in the URL
(jdbc:as400://180.0.0.13/gxdtacv), in the build.xml forcing
(table generate="true" name="gxdtacv.vcc001" pktable="test")
[middlegen] Database URL:jdbc:as400://180.0.0.13;translate binary=true
[middlegen] No <table> elements specified. Reading all tables. This
might take a while...
BUILD FAILED
middlegen.MiddlegenException: Middlegen successfully connected to the
database, but couldn't find any tables. Perhaps the specified schema or
catalog is wrong? -Or maybe there aren't any tables in the database at
all?
This most likely means that you have specified an incorrect schema
and/or catalog.

See this old response from Eivind (which I found with google):

http://www.mail-archive.com/middlegen-***@lists.sourceforge.net/msg00537.html

Hope this helps,
Aslak
Can you help me ? Do you have any idea ?
Thanks a lot.
Fabio.
<property name="database.script.file"
value="${src.dir}/sql/${name}-db2400.sql"/>
<property name="database.driver.file"
value="${lib.dir}/jt400.jar"/>
<property name="database.driver.classpath"
value="${database.driver.file}"/>
<property name="database.driver"
value="com.ibm.as400.access.AS400JDBCDriver"/> <property
name="database.url"
value="jdbc:as400://180.0.0.13;translate binary=true"/>
<property name="database.userid" value="genexus"/>
<property name="database.password" value="password"/>
<property name="database.schema" value=""/>
<property name="database.catalog" value=""/>
<property name="jboss.datasource.mapping" value="db2"/>
import java.io.*;
import java.lang.*;
import java.sql.*;
import java.util.*;
class teste
{
public static void main (String[] argv)
{
Connection as4Conn = null;
Properties as4Properties = new Properties();
as4Properties.put ("user", "genexus");
as4Properties.put ("password", "password");
String urlas4 = "jdbc:as400://180.0.0.13;translate binary=true";
try {
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
as4Conn = DriverManager.getConnection(urlas4, as4Properties);
as4Conn.setAutoCommit( false);
String select = null;
ResultSet rs;
try
{
Statement stmtas4 = as4Conn.createStatement();
String campo1 = null;
String campo2 = null;
String campo3 = null;
select = "select * from gxdtacv.vcc001";
rs = stmtas4.executeQuery( select );
while( rs.next()) {
campo1 = rs.getString(1);
campo2 = rs.getString(2);
campo3 = rs.getString(3);
System.out.println( "" + campo1);
System.out.println( "" + campo2);
System.out.println( "" + campo3);
}
stmtas4.close();
}
catch(Exception e)
{
System.out.println("pau1");
e.printStackTrace(); // <----- Note: I added the
}
finally { }
}
catch (Exception e)
{
System.out.println("pau2");
System.out.println(e.getMessage()); // That I Added
e.printStackTrace();
}
}
}
Loading...