def connect(jclassname, driver_args, jars=None, libs=None):
    """Open a connection to a database using a JDBC driver and return
    a Connection instance.

    jclassname: Full qualified Java class name of the JDBC driver.
    driver_args: Argument or sequence of arguments to be passed to the
           Java DriverManager.getConnection method. Usually the
           database URL. See
           http://docs.oracle.com/javase/6/docs/api/java/sql/DriverManager.html
           for more details
    jars: Jar filename or sequence of filenames for the JDBC driver
    libs: Dll/so filenames or sequence of dlls/sos used as shared
          library by the JDBC driver
    """

    if _gateway_is_running():
        gateway = java_gateway.JavaGateway()
    else:
        driver_args = [driver_args] if isinstance(driver_args, str) else driver_args

        if jars:
            classpath = os.pathsep.join(jars) if isinstance(jars, list) else jars
        else:
            classpath = None

        if libs:
            javaopts = libs if isinstance(libs, list) else [libs]
        else:
            javaopts = []

        gateway = java_gateway.JavaGateway.launch_gateway(
            port=25333, classpath=classpath, javaopts=javaopts, die_on_exit=True)

        java_gateway.java_import(gateway.jvm, 'java.sql.DriverManager')
        gateway.jvm.Class.forName(jclassname)

    connection = gateway.jvm.DriverManager.getConnection(*driver_args)
    if _converters is None:
        types_map = {}
        for type in gateway.jvm.Class.forName("java.sql.Types").getFields():
            types_map[type.getName()] = type.getInt(None)
        _init_converters(types_map)

    return Connection(connection, _converters)