• Topic
  • Discussion
  • UdaWikiWeb.CodeSamplesJava(Last) -- Owiki? , 2016-08-19 14:59:44 Edit owiki 2016-08-19 14:59:44

    Example code

    import java.sql.*;
    
    public class Main {
    
        public static void main(String[] args) {
    
        Connection connection = null;
        String connectionURL = "****** SEE BELOW *****"; 
        
        try {             
                
                Class.forName("openlink.jdbc3.Driver");
                
                connection = DriverManager.getConnection(connectionURL);
                
                System.out.println("Driver: " + connection.getMetaData().getDriverName() 
                        + "  Version: " + connection.getMetaData().getDriverVersion());
                System.out.println("Connected to: " + connection.getMetaData().getDatabaseProductName() 
                        + "  Version: " + connection.getMetaData().getDatabaseProductVersion());
                
                System.out.println("Connection test Successful.");
                
            } catch (Exception ex) {
                System.out.print(ex.toString());
            }
       
        }
    
    }
    

    Basic JDBC Type 1 Connection URL

    Format: jdbc:openlink://ODBC/DSN=<dsn_name>/UID=<username>/PWD=<password>

    Example: jdbc:openlink://ODBC/DSN=access/UID=/PWD=

    Basic JDBC Type 3 Connection URL

    Format: jdbc:openlink://<hostname>:<port>/SVT=<server_type>/DATABASE=<database>/OPTIONS=<connect_options>/UID=<username>/PWD=<password>

    Example: jdbc:openlink://oplussol3:5000/SVT=Progress 100SQL/DATABASE=isports/OPTIONS=-H localhost -S prs10 -N tcp/UID=sysprogress/PWD=


    Referenced by...