JET Proxy JDBC Driver
The JET Proxy JDBC Driver is the client side portion of the
driver. You use it just like you use any other JDBC driver.
This particular driver is Type 3 and according to Sun's definition of driver
types. It is JDBC 1.2 compliant.
This driver should work with JDK 1.1 thru 1.3, no matter what VM
version your JET Proxy server is running.
Quick Start
Driver Class: com.jet.jdbc.pdriver.PDriver
Connection URL format:
jdbc:jet:proxy@<machine>:<port>?share=<sharename>
[&user=<user>&password=<password>]
- <machine> : The IP or host name of the machine running the JET Proxy
Server
- <port>: The port number that the JET Proxy Server is configured
to listen on
Supported URL Parameters:
|
Parameter |
Definition |
Required? |
| share |
The name of the share that you are attempting to
connect to on the server. The JETProxy Server needs to
have a share name defined with the same value that is specified
here. |
Yes |
| user |
Depending on the Proxy configuration, you may or may
not need to supply a user name and password. |
No |
| password |
Depending on the Proxy configuration, you may or may
not need to supply a user name and password. |
No |
Below is a sample test program that uses the JET Proxy JDBC driver.
import java.util.*;
import java.sql.*;
import com.jet.jdbc.pdriver.*;
/**
* Test Client for the JET Proxy JDBC driver.
*/
public class TestClient
{
/**
* Runs the test.
*/
public static void main (String args[])
{
// The host running the JET Proxy Server
String host="localhost";
// The port the server is listening on. Default is 52372.
int port=52372;
// The name of the "share" on the ProxyServer
String share="Northwind";
try
{
// To use the extended features of the ProxyServer we will need
// to load the PDriver as type PDriver.
//
// If the extended features are not necessary, it is perfectly
// valid to load the driver with:
// Class.forName("com.jet.jdbc.pdriver.PDriver");
PDriver pdriver=PDriver.getInstance();
// This is one of the extended features available with the
// PDriver. You can ask a server at a given host and port for
// the shares that it has published for use.
Vector shares=pdriver.getAvailableShares(host, port);
System.out.println ("Shares: "+shares);
// Build the connection URL
String connectionURL="jdbc:jet:proxy@"+host+":"+port+"?share="+share;
System.out.println ("Connecting to "+connectionURL);
Connection con=DriverManager.getConnection(connectionURL,
new Properties());
// At this point we have a JDBC Connection
//
// We'll run a simple test by executing a select and printing
// out the results.
Statement state=con.createStatement();
String sql="select * from customers";
ResultSet rs=state.exechttp://localhost/products/JET_Proxy/driver.jsputeQuery(sql);
boolean more=rs.next();
while (more)
{
System.out.println(rs.getString("CustomerID")+" "+
rs.getString("ContactName")+" "+
rs.getString("Phone"));
more=rs.next();
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
|
|