<<

Contents

Search

>>

 

JDBC_CONNECT

 

 

Function

 

 

Syntax:

JDBC_CONNECT(<File Number>,<Name of Database>,<User Identification>,<Password>[,<JDBC Driver>])

 

<File Number>

= <NUM-EXPRESSION>

<Name of Database>

= <STRING-EXPRESSION>

<User Identification>

= <STRING-EXPRESSION>

<Password>

= <STRING-EXPRESSION>

<JDBC Driver>

= <STRING-EXPRESSION>

 

 

Meaning:

Opens a connection to a JDBC database.

 

JDBC_CONNECT returns 0, if no error occurred, otherwise –1.

 

If an error occurred, the variable OK contains the error number and the function JDBC_GET_LAST_ERROR$ returns the error text.

 

Parameter:

File Number

Number by which the JDBC database is called. The number must be between 1 and 255.

 

Name of Database

Name of the database to be oopened. The complete URL of the database must be specified. The complete URL has the following syntax:

 

jdbc:<Subprotocoll>:<Name of Database>

 

Samples:

jdbc:odbc:customer   // ODBC
jdbc:db2:employee   // DB2
jdbc:msql://<host[:port]>/sales   // mSQL

 

With the JDBC-ODBC driver either the complete URL or just the name of the database can be specified.

 

User Identification

User-ID

 

Password

Password

 

JDBC Driver

If this parameter is missing or if <JDBC-Treiber> = "", the JDBC-ODBC driver "sun.jdbc.odbc.JdbcOdbcDriver" is used.

 

Sample:

H% = JDBC_CONNECT(3,"Sales","Id45","Xyz123",

                  "jdbc:db2://localhost:5000/sample")

IF H% = -1

THEN ERRORMES = JDBC_GET_LAST_ERROR$

ENDIF

 

See also:

JDBC_DISCONNECT

JDBC_MODE