Hi
I have pasted some java code below (There used to be a
site where you can paste the code and provide link
here)
Can some one run this program on AS400,
To do so, start QSH session on AS400 and issue command
java -Djava.version=1.5 -cp
.:/QIBM/ProdData/OS400/jt400/lib/jt400Native.jar
TestConn
You can change the library list in the code to suite
your requirement, this piece of code works fine
outside AS400, library list is set properly.
What job should i be looking for when running on
AS400, when i am running this job outside AS400 i can
look job QZDASOINIT in QUSRWRK subsystem.
**********************************************
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
public class TestConn
{
private String system = "";
private String user = "";
private String password = "";
private String libl = "QTEMP QGPL MAIL200804
MAPS6304F3";
public TestConn()
{
}
public void createConn()
{
System.out
.println("************************************************************");
System.out.println("In Create Conn, creating
connection using URL");
System.out
.println("************************************************************");
try
{
String driver = null;
String url = null;
Properties prop = new Properties();
if (isAS400())
{
driver = "com.ibm.db2.jdbc.app.DB2Driver";
url = "jdbc:db2:*local/;naming=system;date
format=iso;time format=hms;prompt=false;transaction
isolation=read
committed;trace=true;errors=full;libraries="
+ libl + ";";
} else
{
prop.put("user", user);
prop.put("password", password);
driver = "com.ibm.as400.access.AS400JDBCDriver";
url = "jdbc:as400:"
+ system
+
"/;user="+user+";password="+password+";naming=system;date
format=iso;time format=hms;prompt=false;transaction
isolation=read
committed;trace=true;errors=full;libraries="
+ libl + ";";
}
System.out.println("URL " + url);
Class.forName(driver);
Connection db2conn =
DriverManager.getConnection(url);
// db2conn.close();
} catch (Exception exc)
{
exc.printStackTrace();
}
}
public void createConn1()
{
System.out
.println("************************************************************");
System.out
.println("In Create Conn1, creating connection
using Properties");
System.out
.println("************************************************************");
try
{
Properties prop = new Properties();
prop.put("prompt", "false");
prop.put("naming", "system");
prop.put("date format", "iso");
prop.put("time format", "hms");
prop.put("behavior override", "1");
prop.put("translate binary", "true");
prop.put("libraries", libl);
prop.put("user", user);
prop.put("password", password);
prop.put("trace", "true");
prop.put("errors", "full");
String driver = null;
String url = null;
if (isAS400())
{
driver = "com.ibm.db2.jdbc.app.DB2Driver";
url = "jdbc:db2:*local";
} else
{
driver = "com.ibm.as400.access.AS400JDBCDriver";
url = "jdbc:as400:" + system;
}
Class.forName(driver);
Connection db2conn =
DriverManager.getConnection(url, prop);
// db2conn.close();
} catch (Exception exc)
{
exc.printStackTrace();
}
}
private boolean isAS400()
{
String osName = System.getProperty("os.name");
if (osName.equals("OS/400"))
{
return true;
}
return false;
}
/**
* @param args
*/
public static void main(String[] args)
{
TestConn testConn = new TestConn();
testConn.createConn();
testConn.createConn1();
}
}
--- CRPence <crp@xxxxxxxxxxxxxxxxxxxx> wrote:
Sorry, I can not know who your service provider
is. Start with
whomever in your organization would be the likely
contact for an issue
involving your i5/OS. Eventually it should find its
way to IBM.
It seems odd that from the prior example to this
example some twenty
library names were added; /abnormally/ large list.?
Not that it has any
relationship to your issue, but FYI, on some systems
a limit of 25
libraries in the library list may be in effect.
Also in my attempts to perform effectively the
same, I verified my
QZDASOINIT job was effecting a CHGLIBL request and
thus *replaced* the
library list without error; i.e. there was no
interference with a
library already on the list. I was running V5R4M0.
Regards, Chuck
--
All comments provided "as is" with no warranties
of any kind
whatsoever and may not represent positions,
strategies, nor views of my
employer
Ashish Kulkarni wrote:
As per your suggestion I changed my URL, the
actual URL is as below
jdbc:db2:*local/;naming=system;date
format=iso;time
format=hms;prompt=false;transaction
isolation=read
committed;trace=true;errors=full;
libraries=,MS006S,MAPS6304QA,MAPS6304DV,MAPS6303DV,MAPS6302DV
,MAPS6301DV,MAPS6300,MAPS6304F3,FSUTIL,FLDSYSGPL,QGPL,QTEMP,DBU70
,DISTRIBUTE,WRKDBF,HELPLIB2,MAIL200804,MWILIB,REGP1001QA,REGP1001DV
,REGP1000,REGP1001F3,RPGTOOLBOX,CXFSA6304,TLABARCODE,TAATOOL
and i get the same error,
I started the library list with ',' but still it
won't replace the
current library list.
Library MWILIB added to library list.
Library MAIL200804 already exists in library
list.
Trigger program or external routine detected an
error.
Where MAIL200804 is already in jobs library list.
I am running this program on AS400, don't know
whom should I open
ticket with, is it IBM or some one else?
--
This is the Java Programming on and around the
iSeries / AS400 (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the
archives
at http://archive.midrange.com/java400-l.
A$HI$H
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
As an Amazon Associate we earn from qualifying purchases.