JDBC Connection from JAVA to iSeries DB

115 pts.
Tags:
Java
Java Database Connectivity
JDBC
Rational Developer for IBM i
I have a simple class that resides on my local drive. I am attempting to connect to iSeries I5V4 environment and do "select" from one of the DB files. When I run my .class file in Rational Application Development I ghet a "class not found" exception. How do I set classpath in RAD? Should my application (java class file) reside on IFS ? What should the classpath be ? New to Java... Any feedback is greatly appreciated

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

If your class file is in your local PC and using RAD java perspective, you can run your class.

RAD’s java perspective is a Java SE development tool, you don’t need to set the class path in general.

Do you have your java project setup in RAD ? Are you calling your java class from java project?

in COM statement error is occurred. so what can i do?

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Paulsundarsingh
    package COM.ibm.db2.jdbc.app; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.*; import javax.sql.*; import COM.ibm.db2.jdbc.app.DB2Driver; public interface DB2Driver { } public static void main(String[string] args) { try { Class.forName("COM.ibm.db2.jcc.DB2Driver"); Connection db2Conn = DriverManager.getConnection("jdbc:db2:empdetails","db2admin","db2admin"); Statement st = db2Conn.createStatement(); String myQuery = "SELECT * FROM empdetails"; ResultSet resultSet = st.executeQuery(myQuery); while (resultSet.next()) { String name = resultSet.getString("name"); String age = resultSet.getString("age"); System.out.println("Name: " + name); System.out.println("Age: " + age); System.out.println("-------------------------------"); } resultSet.close(); st.close(); db2Conn.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } } this is my pgm. but error is occurred in [COM & main function] so what can i do? plz help me.
    40 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following