Hi,
You can also use DBI (DataBase Interface) to access the sequoia JDBC driver from Perl.
The Perl DBD:JDBC module consists of two parts:
. a DBD::JDBC server that acts as a proxy server for JDBC
. a DBD::JDBC perl module that is loaded by the perl client and that references the DBD::JDBC server.

To use DBI, you must:
1. compile and install the DBD::JDBC Perl module
2. place the dbd_jdbc.jar file and the sequoia JDBC driver on the machine where you wish to run the DBD::JDBC server.
3. add the dbd_jdbc.jar and the sequoia driver to your classpath.
4. start the DBD::JDBC server
5. configure the data service name (DSN) of the Perl client application.


 *** Installing the DBD::JDBC Perl module ***
You can obtain the DBD::JDBC module at http://www.cpan.org, for example.
For the installation to be succesful, the following prerequisites are required:
. Sun Microsystems® Java Virtual Machine compatible with JDK version 1.4.2
. sequoia driver
. log4j.

If you use a command line utility such as cpan, it will automatically fetch, compile and install the module and produce a dbd_jdbc.jar file in the ~/.cpan/build/DBD-JDBC-x.y/ directory (where x.y is the version number).
The dbd_jdbc.jar file contains the DBD::JDBC server component, that is, the java classes and their source code.
You can compile and install the DBD::JDBC module using the following command:
perl -MCPAN -e 'install Bundle::DBD::JDBC'
After installing the DBD::JDBC module, run the DBD::JDBC server and provide the following system properties on the command line:
. jdbc.drivers - the sequoia driver class name
. dbd.port - the port which the Perl client applications use to connect and to which the server will listen
. dbd.trace - if set, this value indicates the tracing level for the server. Tracing output will be written to stderr. Legal values are silent (the default), brief, verbose, tedious, and abusive.

*** Configuring the data source for Perl applications ***
To configure the data service name (DSN), you must specify the following:
. the hostname on which the DBD::JDBC server is running (optionally followed by the port on which the DBD::JDBC server is running: $host and $port)
. the sequoia JDBC URL (jdbc:sequoia://$CONTROLLERNAME1,$CONTROLLERNAME2/$DBNAME), followed by the virtual username and password combination ($USERNAME and $PASSWORD).
Example:
#!/usr/bin/perl -w
# call the required modules
use DBI;
use DBD::JDBC;
# The actual DSN (one line, separated here for readability)
my $dbh =
DBI->connect( "dbi:JDBC:hostname=$host;port=$port;
url="" "$USERNAME","$PASSWORD" )
or die print $DBI::errstr;

Thank you for your interest in Sequoia and in Carob,
Gilles.


Csaba E. Simon a écrit :
Hi Nikolay,

  
how  make connection from perl to carob
    

One possible way is to use the libmysequoia library:
http://carob.continuent.org/LibMySequoia

LD_PRELOAD=/path/to/libmysequoia.so your_perl_program.pl

Regards,
Csaba


_______________________________________________
Carob mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob

  

_______________________________________________
Carob mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob

Reply via email to