Connecting to the progress database using jdbc to retrieve the infirmation from the t

mythily.1987

New Member
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.

Is there any problem with the driver.

One more thing i wanted to tell you, we can able to login retrieve the data from our IMS(tool which we are using to connect to the progress and retrieve the data)
But when we connect from java getting the error.

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();
}

}
 

tamhas

ProgressTalk.com Sponsor
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

The issue is the _width field in the _file definition. You can set this manually to a high enough value or look up the dbtool utility which will scan the database and set it for you.
 

RealHeavyDude

Well-Known Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

The Progress/OpenEdge database is not an SQL database in the first place. Therefore many things work differently from a philosophical point. The format definition for a character fields is one of these things. It only defines the default display/input format for the field but does not limit to it. This format can be override in every visualization object and business logic processing is not bound to it at all. Therefore Progress introduced the SQL width which is calculated automatically, but only when the field is created. But you can execute it on demand in running the DBTOOL against the database and fix the SQL width based on the current content of the character fields.

Heavy Regards, RealHeavyDude.
 

mythily.1987

New Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

Thanks for the replay..

But I'm not having the option to edit from the database side.

So, I need to handle it from my Java code itself.

Is there any way to do this?
 

RealHeavyDude

Well-Known Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

Running the DBTOOL against the database is a task which must be executed by the database administrator. AFAIK you have no other option.

Heavy Regards, RealHeavyDude.
 

mythily.1987

New Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

Is there any errect on the data in the database by running the dbtool or by changing the width of the column from data directory in progress.
Since our progress database is having huge amount of data and its a very complicated system.
 

RealHeavyDude

Well-Known Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

You can run it online and there is no impact on the data itself and on ABL application apart from a small performance hit.

Heavy Regards, RealHeavyDude.
 

mythily.1987

New Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

You have just written small performance hit.
Can you explain that littele bit
 

RealHeavyDude

Well-Known Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

I should have been more precise: A small performance hit while the DBTOOL is running because - depending on your settings all or just some tables are processed - it will cause additional database I/O. For that reason I would not run it during peak times.

Heavy Regards, RealHeavyDude.
 

mythily.1987

New Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

Hello..

I need to connect to the progress database to retrieve the data from the tables.
But for some of the columns are giving the error

Exceded maximum length or precision...

but I'm not having the permision to change anything in the database...
using the data directory or using dbtool.

is it possible to get the data using any other programing languages or in any onthe way.
 

RealHeavyDude

Well-Known Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

For the record: Running the DBTOOL against the database to fix the SQL widths does not change the database in the common sense - it fixes the SQL width so that SQL clients are able to retrieve the data. This is a standard database administration task - why it should not be possible or allowed eludes me. If whoever is responsible for that decision is still insisting that you retrieve data from that database via SQL ( be it ODBC or JDBC ) without providing the proper environment, I would say that this person is either incompetent or narrow-minded like hell.

The only other option to access the data then is using the Progress 4GL ( as the ABL was called back then ).

Heavy Regards, RealHeavyDude.
 

mythily.1987

New Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

where can i find tutorial for progress 4GL.
Since I'm new to this technology.
 

tamhas

ProgressTalk.com Sponsor
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

You could start with the documentation... You can find complete sets on PSDN if you don't have another source.

The irony here is that, as RHD says, running dbtool is a routine maintenance task for any OE database which is going to be accessed by SQL, similarly UPDATE STATISTICS. This is not something I would expect you to do, but rather for the DBA to do for you ... and do it on a regular basis. Whereas, going after the data via ABL implies giving you access to the Progress editor, something I stringently avoid doing unless the person is a trustable developer.
 

LarryD

Active Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

I'm not sure that dbtool was available for 9.1B. I don't think it was introduced until 9.1D06. You may want to check your Progress install directory/bin to see if dbtool is there.
 

tamhas

ProgressTalk.com Sponsor
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

To summarize:
There are two languages one can use for querying a Progress database - ABL and SQL.
SQL pays attention to and is limited by the field _WIDTH so it is critical that this be set wide enough for the data.
Setting that width is a routine DBA task which should be done for any DB that is accessed with SQL.
The easy and painless way to set it correctly is with dbtool, if that is available for your version.
It may also be set with ABL code, but then you also have to figure out the right value.
It is the DBAs job to do this, not a user programmer.
The DBA should also be running update statistics on any DB accessed with SQL.
If he or she isn't fixing the width, chances are update statistics isn't being run either.
Since ABL doesn't pay any attention to _WIDTH, it doesn't have this issue.
But, use of ABL implies having to learn enough and being granted permission to use a Progress editor.

There is no other choice. OK?
 

mythily.1987

New Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

Using progress 4GL programming language is it possible to write the output to a specific text file?

Since I'm new to the 4GL technology Please give me some suggitions.

How we can take the data from progress database using 4GL and then use the output of that in other programming languages like java.
 

rzr

Member
Re: Connecting to the progress database using jdbc to retrieve the infirmation from t

in it's most simplest form... you can send data to text file using below code.

OUTPUT TO C:\Temp\MyOutFile.txt.
EXPORT "I sent data to text file".
EXPORT "This is new line".
OUTPUT CLOSE.

If you want to send data from db table then there are many examples in this forum & in progress handbook; that you can download from psdn.

Data exported from progress; in CSV or JSON format etc.. can then be read by simple (hoefully!) code Java.

If you are not into ABl/4GL programming then have someone from development team do this for you.. should be straight forward.
 
Top