replace local host by entering IP address in connection string

itpragmatic

New Member
Experts,

I am newbie in Progress database. I am retrieving data contents from database using a java code. Following is my code.
Code:
import java.sql.*;
import java.io.*;
import java.net.URL;



public class JDBCDemo 
{

    Connection con;                    // Connection object 
    public JDBCDemo() 
    {
        
        
    }
    public void getConnection()
    {
        try
            {           

                
               
String drivername="com.progress.sql.jdbc.JdbcProgressDriver";
                Class.forName(drivername);

                System.out.println ("Class Found...");         


            
            String url = "jdbc:jdbcprogress:T:localhost:2500:sports2000";

                
                System.out.println ("This is driver...");
                
                con = DriverManager.getConnection(url,"sysprogress","sysprogress");                System.out.println ("this is getconnection...");
                Statement stmt = con.createStatement();     
                System.out.println ("Class Found1...");
                
            String query = "Select * from pub.Customer"; 

 
                System.out.println ("Class Found2...");
                
           
            ResultSet rs = stmt.executeQuery(query);     

                while(rs.next())
                {
                    System.out.println("Num :" + rs.getString("CustNum"));
                    System.out.println("Name :" + rs.getString("Name") + "\n");
                    
                }
                    
            }
            catch(Exception e)
            {
                    System.out.println("Exception is....."+e);
            }
    }

    public static void main(String args[])
    {
        JDBCDemo obj = new JDBCDemo(); // object of JDBCDemo is created here
        obj.getConnection();
    }
}
I am able to see the result when I use localhost. String url = "jdbc:jdbcprogress:T:localhost:2500:sports2000";

If I want to retrieve it using ip address, how could I do this? I tried with several options.
String url = "jdbc:jdbcprogress:T:192.168.1.12:2500:sports2000"; or
String url = "jdbc:jdbcprogress:T:'192.168.1.12':2500:sports2000";
None of them works. Also note I am including all the jar files correctly. e.g. progress.jar and jdbc.jar. command is

java -cp .;progress.jar;jdbc.jar JDBCDemo
this is working fine for the localhost. There is no error in the command or in jar inclusion.

If i want to access the same code from different machine, I am just replacing localhost by corresponding IP address for the time being. The other machine does not have progress installed on it. What should be done in order to get this right? please help.

I am getting following error.
Exception is.....java.sql.SQLException: No suitable driver found for jdbc:jdbcpr
ogress:T:'192.168.1.12':2500:sports2000
Please suggest your ideas/suggestions.
Thanks in advance.
 
How about if you set a hosts entry that points at your IP Address and then use

Code:
String url = "jdbc:jdbcprogress:T:SomeHostName:2500:sports2000";
 
@Cringer

Thank you very much for your reply. It works for the local host. I should have edited my post earlier. If on the user's machine there is no progress installed, and i have only progress.jar, jdbc.jar and above program....in that case what I should do? It would be a great help.
 
Thank you very much again for your quick reply Cringer. Unfortunately, it is not going to help as we are using strictly progress 9.1 d due to some reasons. I know that jdbc.jar(Progress 9.1D) has changed to openedge.jar(OpenEdge10.1B).But we are no using OpenEdge.
 
To use a jdbc connection on a machine who has not progress installed is not possible.
To get works you have to install on the non-progress machine named "SQLClientAccess" which
is a deployement componet. You have to download this component and install it to you non-progress
machine. To use the Progress JDBC driver you need some jar archive but you need some libraries depending
your operating system. To find this component is complicated on progress download centrer. You have to ask about
to you love Progress Customer Service Representative.
 
As Rares already said you need more than just the jar files for this to work. The JDBC driver for V9 is a type 3 driver (not a type 4 as in OE), this means that is not pure Java and it also needs client-connect libraries (low-level c libraries)... depending on your OS the libraries needed are different and need to be placed in LIBPATH or PATH.

http://communities.progress.com/pcom/docs/DOC-11018
 
Thank you very much for the reply. I couldn't do any progress on this issue. I was looking on some java related issues. So if I do not have progress installed on my machine then I won't be able to execute that java application from other machine where java is not installed?
 
I am using XP service pack 3. I am able to execute the java file on my machine where progress is installed already. If I want to execute the same program from other machine where progress is not installed; then it is not possible? Please help.
 
as already say, you can not. You have to go to progres-download-center and download/install "SQLClientAccess"
for you progress version and OS. Is free , is a deployement product, like NameServer, WebClient etc.
 
@rstanciu
Thank you very much for your reply. Somehow we were able to resolve the issue by installing few components. I believe Progress 9.1 D DB enterprise edition comes with that particular component. I will focus to get SQLClientAccess in near future as whatever we tried was the solution for the time being. Thank you very much for your help.

Best regards.
 
Back
Top