I hope I am not repeating a question but I googled and googled and could not find the answer. I need to get data of Hybris database. The guys at hybris sent me a url to connect to and said I need to run a jdbc client in order to do so. as I am running Perl code I tried following the steps described in this url: http://search.cpan.org/~vizdom/DBD-JDBC/JDBC.pod I coded this:
my $host = 127.0.0.1;
my $port = 9001;
my $url = "a url provided by Hybris";
$url =~ s/([=;])/uc sprintf("%%%02x",ord($1))/eg;
my $dsn = "dbi:JDBC:hostname=$host;port=$port;url=$url;";
my %properties =
(
'user' => 'User provided by Hybris',
'password' => 'password provided by Hybris',
'host.name' => 'hostname from url provided by Hybris',
'host.port' => 'port provided by Hybris'
);
my $dbh = DBI->connect($dsn, undef, undef, { PrintError => 0, RaiseError => 1, jdbc_properties => \%properties } ) or die "Failed to connect: ($DBI::err) $DBI::errstr\n";`
I am sorry but cannot provide actual url and user name as this is a production system. I keep getting an error:
DBD::JDBC initialisation failed: Can't locate object method "driver" via package
"DBD::JDBC" at C:/Perl64/lib/DBI.pm line 811.
Perhaps the capitalisation of DBD 'JDBC' isn't right. at monitorHybrisDB.pl line
23
( The server from the perl URL loaded OK )
I tried googling this error but so far I found nothing but some more people with the same problem.
When I tried coding in Java I wrote the following code:
public class GetHybrisOrders {
public static void main(String[] args) throws SQLException {
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("de.hybris.vjdbc.VirtualDriver").newInstance();
} catch (Exception ex) {
// handle the error
}
Connection conn = null;
try {
conn =
DriverManager.getConnection("jdbc:hybris:flexiblesearch:url Provided by hybris =username &password=password provided by hybris");
// Do something with the Connection
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
}
}
I keep getting this stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at de.hybris.vjdbc.VirtualDriver.<clinit>(VirtualDriver.java:39)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at GetHybrisOrders.main(GetHybrisOrders.java:11)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
Can anyone help me with finding a splution in either Java or Perl?
thanks, Adam