× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott,

Thank you for your help. I'm a complete novice with Java. I'm saving your instructions for next time.

It turned out to be a signing on issue needing some more properties set in the jtds definition because of our local environment. The JDBCR4 subprocedures are working great and our proof of concept has moved past connecting to MS SQL and now waiting for a temporary license with the third party software.

Thanks again.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Sunday, March 26, 2017 3:46 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: JTDS (JDBC Driver) & JDBCR4 Connect String

Jack,

The beginning of this stack dump is FAR FAR more useful than the end of
it... why did you only include the end?

If the problem is that it is scrolling past and you cannot stop it, then do this:

1) Start a fresh job
2) Type OVRPRTF FILE(STDOUT) TOFILE(QSYSPRT) HOLD(*YES)
3) Type OVRPRTF FILE(STDERR) TOFILE(QSYSPRT) HOLD(*YES)
4) Run your program that is failing
5) Sign off.

Now you should have the complete message in the spool. Please get the details from the START of the error dump and post them here so that we know what problem you're experiencing.

-SK



On 3/21/17 10:07 AM, Jack Prucha wrote:
I've cross posted this so I hope you're not annoyed if you get this twice.

I'm trying to connect to MS SQL from RPGLE using Scott Klement's JDBCR4 service program. (Thank you! Scott. Have enjoyed your sessions at the last two RPG/DB2 Summit Conferences in beautiful suburban Lombard Illinois) I've been fighting this since Friday and hoping someone can help me login to the MS SQL database. I can connect using Microsoft SQL Server management Studio using it's driver and windows authentication (no password supplied) so I have the authorization. Got past the JVM & JDBC mismatch issue yesterday morning by getting a later JDK installed on the iSeries (7.1). I run this before calling the RPGLE that trying to connect:

ADDENVVAR ENVVAR(CLASSPATH)
VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk71/32bit') REPLACE(*YES)

I call my program. JVM starts up with no error messages. Then I'm getting this:

at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnosti
c.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.jav
a:371)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
Exception in thread "main" java.sql.SQLException: Login failed for user 'CFI\
JPRUCHA'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnosti
c.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.jav
a:371)
at
net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)

Login failed for user 'CFI\JPRUCHA'.

My application code, which calls JDBCR4 subprocedures, looks like this:


// Setup ClassPath before starting JVM

p_envval = getenv('CLASSPATH');
if (p_envval <> *null);
EnvVal = %str(p_envval);
endif;
if %scan('.:':EnvVal) = *zeros;
eval EnvVal = '.:' + EnvVal;
eval EnvValChanged = *on;
endif;
if %scan('/sqljdbc.jar':EnvVal) = *zeros;
eval EnvVal = EnvVal + ':/MSSQL/jtds-1.3.1.jar';
eval EnvValChanged = *on;
endif;
if EnvValChanged;
putenv('CLASSPATH=' + EnvVal);
endif;

UserId = 'CFI\JPRUCHA';
PassWrd = '########';

conn = JDBC_Connect('net.sourceforge.jtds.jdbc.Driver'
:'jdbc:jtds:sqlserver://T0B-DBMS03:1086'
+'/LaserRepository;'
+'instance=ISCR01'
: %Trim(UserId)
: %Trim(PassWrd));

if (conn = *NULL);
return;
endif;



The port is what the firewall setup is here but I've tried 1433 also. I've been all over the various Midrange listservs and everywhere else seeing different methods of setting up the Connect string. Am I doing something wrong here? Can someone supply a working example?

TIA

Jack Prucha
Programming Team Supervisor
College Foundation, Inc.
919.835.2530

This email, including any documents, files, or previous email messages attached to it, has been sent from an email account of College Foundation Inc., (CFI) and may contain confidential, proprietary, or legally privileged information belonging to CFI. If you are not the intended recipient, any dissemination, distribution, or copying of this email or its attachments is strictly prohibited. If you have received this email in error, please immediately notify the sender by email and destroy the original email and any attachments.


--
Scott Klement
http://www.scottklement.com
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.