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



I'm trying to setup connections to our SQLServer 2005 & 2008 servers.

I'm not at all familiar with JDBC stuff or setting up java. I've been following Scott's presentation:
http://www.scottklement.com/presentations/External%20Databases%20from%20RPG.pdf

I downloaded the jtds jar and placed it in the IFS root in a folder called /java/jdts/
The jar is jtds-1.2.5.jar. I thought I'd rename it to try jtds.jar as well. Since it wasn't working I didn't know if I needed the /java/jdts/ under the Home directory in the IFS so I put it there as well.

Here is the code I'm trying to run (taken from Scott's MSSQLTEST source):
/copy jdbcr4lib/qrpg,jdbc_h

D getenv PR * EXTPROC('Qp0zGetEnvNoCCSID')
D name * VALUE OPTIONS(*STRING)

D putenv PR * EXTPROC('Qp0zPutEnvNoCCSID')
D name * VALUE OPTIONS(*STRING)

D EnvVal S 256A VARYING
D EnvValChanged S N INZ(*off)
D p_EnvVal s *

D ErrMsg s 50A
D wait s 1A
D count s 10I 0

D CaseID s 15A

D conn s like(Connection)
D rs s like(ResultSet)
D prop s like(Properties)
D prepstm s like(PreparedStatement)

// Set up CLASSPATH before starting JVM

p_envval = getenv('CLASSPATH');
if (p_envval <> *null);
EnvVal = %str(p_envval);
endif;
if %scan('.:':EnvVal) = *zeros;
EnvVal = '.:' + EnvVal;
EnvValChanged = *on;
endif;
if %scan('/sqljdbc.jar':EnvVal) = *zeros;
//EnvVal += ':/java/jdbc/jdts-1.2.5.jar';
EnvVal += ':/java/jdbc/jdts.jar';
EnvValChanged = *on;
endif;
if EnvValChanged;
putenv('CLASSPATH=' + EnvVal);
endif;

prop = JDBC_Properties();
JDBC_setProp(prop: 'userName' : 'user');
JDBC_setProp(prop: 'password' : 'password');
JDBC_setProp(prop: 'databaseName' : 'cdwEQX');

//conn = JDBC_ConnProp('com.microsoft.sqlserver.jdbc.SQLServerDriver'
conn = JDBC_ConnProp( 'net.sourceforge.jtds.jdbc.Driver'
:'jdbc:jtds:sqlserver://172.16.20.20:1433'
: prop );
JDBC_freeProp(prop);

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


test dsply 'connected' 'KURT';
test return;

The error I'm getting is ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver

The FAQ at the JTDS site says it's likely having an issue finding the JAR.
After the program runs I check the environment variable and it looks right:
CLASSPATH '.::/java/jdbc/jdts.jar'

I'm really at a loss here. Anyone have any ideas?

Thanks,
Kurt Anderson
Sr. Programmer/Analyst
CustomCall Data Systems

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.