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



On 9/2/2014 4:48 PM, Graves, Chuck wrote:
Thanks for the reply. The jar file is OK, I see the classes as you said I would, the java source was copied (drag/drop) and re-compiled on the iSeries. All good. It runs but gives the "no suitable driver found for" and lists the connection parameters (connection string)... the same string works from my PC. Evan calling it with the -cp parameter (java -cp /java/jdbc/sqljdbc4.jar:. ibmiToSqlServer6) produces the same results

OK, can you paste the exact message you're getting? And perhaps the
source code? Here is a bit of working code from a proof of concept I
did. It ran fine on V5R4 as well as now on 7.2

import java.sql.*;
import java.util.Properties;

public class MSSQLtest {

private Connection connection = null;
public static void main(java.lang.String[] args) {

MSSQLtest test = new MSSQLtest();
test.runQuery();
test.cleanup();
}

public MSSQLtest() {

Properties properties = new Properties ();
properties.put("user", "uuuuuu");
properties.put("password", "pppppp");
properties.put("databaseName", "dddddd");

try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection =
DriverManager.getConnection("jdbc:sqlserver://10.1.nnn.nnn:1433",
properties);
System.out.println("DATABASE NAME IS:"
+ connection.getMetaData().getDatabaseProductName());

} catch (Exception e) {
System.out.println("Caught exception: " + e.getMessage());
}
}



public void runQuery() {
try {
Statement s = connection.createStatement();
ResultSet rs = s.executeQuery("select * from
information_schema.columns");

System.out.println("--------------------");
int i = 0;
while (rs.next()) {
System.out.println(rs.getString("table_name")
+ " " + rs.getString("column_name")
+ " " + rs.getString("data_type")
+ " " + rs.getString("character_maximum_length")
+ " " + rs.getString("numeric_precision")
+ " " + rs.getString("numeric_scale"));
i++;
}

System.out.println("--------------------");
System.out.println("There were " + i + " rows returned.");
System.out.println("Output is complete.");

} catch (SQLException e) {
System.out.println("SQLException exception: ");
System.out.println("Message:....." + e.getMessage());
System.out.println("SQLState:...." + e.getSQLState());
System.out.println("Vendor Code:." + e.getErrorCode());
e.printStackTrace();
}
}

public void cleanup() {
try {
if (connection != null)
connection.close();
} catch (Exception e) {
System.out.println("Caught exception: ");
e.printStackTrace();
}
}
}

I'm also using sqljdbc4.jar. In my case, it's in /java, along with this
code; that's where all of my Java code is stored. I don't have a lot of
it :-) My CLASSPATH is
CLASSPATH=.:/java:/java/sqljdbc4.jar:/java/jt400.jar:/java/db2jcc4.jar:/java/opencsv-2.3.jar


--buck

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.