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



You're using user/password for SSMS, not Windows authentication?



-----Original Message-----
From: Jack Prucha [mailto:Jack.Prucha@xxxxxxx]
Sent: Tuesday, March 21, 2017 11:59 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: RE: JTDS (JDBC Driver) & JDBCR4 Connect String

Yes. I can connect, look at tables and data thru SQL Server Management Studio.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Justin Taylor
Sent: Tuesday, March 21, 2017 12:15 PM
To: Midrange Systems Technical Discussion
Subject: RE: JTDS (JDBC Driver) & JDBCR4 Connect String

Pardon the obvious question, but have you logged into SQL Server directly to double-check your credentials?



-----Original Message-----
From: Jack Prucha [mailto:Jack.Prucha@xxxxxxx]
Sent: Tuesday, March 21, 2017 10:08 AM
To: midrange-l@xxxxxxxxxxxx
Cc: rpg400-l@xxxxxxxxxxxx
Subject: JTDS (JDBC Driver) & JDBCR4 Connect String

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.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-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 ...

Follow-Ups:
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.