If you want to use the native driver you should use the class name: "com.ibm.db2.jdbc.app.DB2Driver ", the connection string will also be different..

We use the native driver with WebSphere on i5/OS (actually as a datsource but ultimately that uses the native driver) and we use a specific user profile and password for the database connections. The user profile is not ignored. If the password is wrong the profile ends up being disabled and the connections fail. The resultant database jobs are seen as those named QSQSRVR, we don't see the connections as part of the same (WebSphere) job and that's not just because it's WebSphere, WebSphere is just another java app, albeit very sophistocated.




________________________________
From: Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>
To: Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx>
Sent: Tuesday, 24 February, 2009 21:44:43
Subject: RE: Issue with JDBC connection on AS400

Your user id and password on the connection parameters are ignored with
the native driver. Your JDBC query will be done in the same job as your
java jvm is running even though it might be running in a different
thread within that job. A job has only one profile at a time. The native
jar is all about staying in the same job. If you call a program, it is
executed within the same job. Check the job log of the job where this
jvm is running. You'll find the entries there for any errors and any
messages the job is logging. JDBC in native is just like calling an
embedded SQL program.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Ashish Kulkarni
Sent: Tuesday, February 24, 2009 12:51 PM
To: Java Programming on and around the iSeries / AS400
Subject: Re: Issue with JDBC connection on AS400

HiThis is how my java program is, i do not use local user, but specify a
user id and password for connecting.

This program works with JT400.jar on AS400, but does not work with
jt400Native.jar on AS400.

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class GetAS400JDBCConnection
{
public Connection getJDBCConnection(String system, String userId,String
password, String libraryList, boolean isDebug)throws Exception {
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",
libraryList); prop.put("user", userId); prop.put("password", password);
if(isDebug)
{
prop.put("trace", "true");
prop.put("errors", "full");
}
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
String url = "jdbc:as400:" + system;
Connection db2conn = DriverManager.getConnection(url, prop); return
db2conn; }  public static void main(String args[])throws Exception { new
GetAS400JDBCConnection().getJDBCConnection("AS400", "USER", "PASSWORD",
"QGPL QTEMP", new Boolean("TRUE").booleanValue());
System.out.println("Program completed"); } }

On Tue, Feb 24, 2009 at 12:34 PM, Dan Kimmel
<dkimmel@xxxxxxxxxxxxxxx>wrote:

The native stuff will try to keep everything in the same job and will
connect to the database with the user profile associated with the java

job (the job in which the jvm is running. Non-native will create a
connection through the IP port to the database server and operate in a

QZDASOINIT job under the user profile you specify when you create the
connection. Native pretty much ignores the user profile you specify
when you create the connection.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Ashish Kulkarni
Sent: Tuesday, February 24, 2009 11:09 AM
To: Java Programming on and around the iSeries / AS400
Subject: Issue with JDBC connection on AS400

HiI have a java program which creates JDBC connection, I using
com.ibm.as400.access.AS400JDBCDriver as driver, this java program runs

on AS400.
When i run this java program using jt400Native.jar file, i get
following error, but when i run it with JT400.jar file which i copied
from my PC to IFS folder it works

Java call to use jt400Native.jar
java -Djava.version=1.5 -cp
/QIBM/ProdData/OS400/jt400/lib/jt400Native.jar:.
  GetAS400JDBCConnection

feb 24 17:13:56:062 CET 2009  as400: Connection null (1469825337) :
Throwing exception. Original exception: .com.ibm.as400.ac
  cess.AS400SecurityException: General security error.

        at java.lang.Throwable.<init>(Throwable.java:196)

        at java.lang.Exception.<init>(Exception.java:41)

        at
com.ibm.as400.access.AS400ImplRemote.mapNativeSecurityException(AS400I
mp
lRemote.java:2073)

        at
com.ibm.as400.access.AS400ImplRemote.swapTo(AS400ImplRemote.java:2033)

        at
com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:1818)

        at
com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:2585)

        at com.ibm.as400.access.AS400.promptSignon(AS400.java:2156)

        at com.ibm.as400.access.AS400.signon(AS400.java:3426)

        at com.ibm.as400.access.AS400.connectService(AS400.java:877)

        at
com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnec
ti
on.java:3017)

        at
com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver
.j
ava:1256)

        at
com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDri
ve
r.java:1107)

        at
com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:357)

        at
java.sql.DriverManager.getConnection(DriverManager.java:525)
          at
java.sql.DriverManager.getConnection(DriverManager.java:140)

          at
GetAS400JDBCConnection.getJDBCConnection(GetAS400JDBCConnection.java:2
8)

          at
GetAS400JDBCConnection.main(GetAS400JDBCConnection.java:35)



  mar feb 24 17:13:56:063 CET 2009  as400: Connection null
(1469825337)
:
Throwing exception.  Actual exception: The application se
  rver rejected the connection. (General security error.) sqlState:
08004 vendor code -99999.java.sql.SQLException: The application
    server rejected the connection. (General security error.)

          at java.lang.Throwable.<init>(Throwable.java:196)

          at java.lang.Exception.<init>(Exception.java:41)

          at java.sql.SQLException.<init>(SQLException.java:40)

          at
com.ibm.as400.access.JDError.throwSQLException(JDError.java:528)

          at
com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnec
ti
on.java:3021)

          at
com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver
.j
ava:1256)

          at
com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDri
ve
r.java:1107)

          at
com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:357)

          at
java.sql.DriverManager.getConnection(DriverManager.java:525)

          at
java.sql.DriverManager.getConnection(DriverManager.java:140)

        at
GetAS400JDBCConnection.getJDBCConnection(GetAS400JDBCConnection.java:2
8)

        at GetAS400JDBCConnection.main(GetAS400JDBCConnection.java:35)



Command to use JT400.jar

java -Djava.version=1.5 -cp /test/jt400.jar:.  GetAS400JDBCConnection


This works, i get JDBC connection, what may be the issue

Ashish
--
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.



--
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.


--
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.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.