12 Replies Latest reply: Sep 13, 2011 2:11 AM by EJP RSS

    Connecting to the progress database using jdbc to retrieve the infirmation

    886290
      Hello Friends,

      We have progress database 9.1B installed on the server.
      i'm connecting to the progress database server from java jdbc connection.
      I'm able to connect to the database and able to retrieve some of the data, But for some columns its giving error that

      [JDBC Progress Driver]:Column FrnDetails in table PUB.GENCOND has value exceeding its max length or precision.

      I undestand that it is the normal problem in the progress database. But unable to find the solution.

      Here is the code for connecting to the Progress database to retrieve the data from the database:

      package com.rep.gen;

      import java.sql.CallableStatement;
      import java.sql.Connection;
      import java.sql.DatabaseMetaData;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;

      public class TestPro
      {
      Connection connection = null;
      Statement st = null;
      ResultSet rs =null;

      public TestPro()
      {
      try {
      Class.forName("com.progress.sql.jdbc.JdbcProgressDriver");
      connection = DriverManager.getConnection("jdbc:JdbcProgress:T:ip_address:port_no:database_name","username","password");
      if(connection !=null)
      {
      System.out.println("connection success");
      }
      } catch (Exception e) {
      e.printStackTrace();
      }
      }
      public void vGetValues()
      {
      String sql = "select FrnDetails from pub.GENCOND";
      try{
      st = connection.createStatement();
      rs = st.executeQuery(sql);
      while(rs.next())
      {

      String temp = rs.getString("FrnDetails");
      }
      }
      catch(Exception e)
      {
      System.out.println(e.getMessage());
      }
      finally
      {
      try {
      connection.close();
      } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }
      }
      }

      public static void main(String a[])
      {
      TestPro tp = new TestPro();
      //tp.vGetColumnNames();
      tp.vGetValues();
      //tp.vTestStoredproc();
      }

      }