Python Database Connection String with Derby Database - python-2.7

Just to let you know about the problem i am facing, I will give a short introduction about what I have been doing.
I am working on a project, where the WEB interface is constructed in Java.
There is a parser built in python, which parses data and stores it into the database.
We were using a MySQL server, but were later asked to change it into DERBY. The java code now works perfectly connecting with the database.
But the python part of the code has problems with connection. I learnt how the derby database works, but find it hard to find articles about connecting to a derby database.
I have the following details:
uname : root
pwd : root
driver class : org.apache.derby.jdbc.EmbeddedDriver
DRIVER LOCATIONS : C:\Users\esusank\AppData\Roaming\RazorSQL\derby\derby10.10.jar
JDBC URL : jdbc:derby:C:\Derby\databases\MyDbTest;create=true
I am finding it hard to find syntax for writing a connection string for DERBY.
I have installed mxODBC driver.
Can someone help me out on this? If you can post some links or some suitable syntax, it will be very much helpful.

To communicate with Derby, you will need to use a JDBC driver. ODBC drivers can't talk directly to Derby; it is a Java-only database.
I believe there are some ODBC-JDBC bridge providers that provide such connection mechanisms, but I'm not sure if they are still in active use.
Another possibility is to use Jython, which is a Java implementation of Python, which may help: see this related question: Derby Database ODBC Connection

Related

is there a way of hosting a mysql database using only Qt?

I am trying to make a program that connect many computers into a local MySQL database hosted by a central computer, but the way I found to host a MySQL database is using an External program as Xampp or WampServer. I am Wodering if I can host a MySQL database using only Qt's classes like QTcpServer without the needing of external programs.
No. MySQL needs a MySQL Server process to manage connections, permissions, SQL parsing, storage engines, caching, etc. You can't use a MySQL database without a MySQL Server.
You might like to explore using SQLite, which is a free embedded database that can be used without requiring a separate daemon process. SQLite is a different product than MySQL, so there will be differences in its implementation of some SQL language features. Be sure to study the SQLite documentation: https://sqlite.org/docs.html
I did a quick Google search (my search phrase was "qt with sqlite") and I found numerous blogs and tutorials about how to use SQLite in an application with Qt. Here's just the first result, but there are others: https://katecpp.github.io/sqlite-with-qt/

Connecting to neo4j using ColdFusion

Has anyone here successfully connected to neo4j using ColdFusion?
I was able to connect to neo4j 1.6.1 using this guide as a starting point: http://ghostednotes.com/2010/04/29/using-neo4j-graph-databases-with-coldfusion
. However, it was a short lived success. I have since uninstalled neo4j 1.6.1 and installed 1.7.
I am now running Apache, CF 9.0.1 on windows XP as a local dev box. I added ...\neo4j-community-1.7\lib to my CF class path and the libraries are listed in CF Server Java Class Path. neo4j is running fine, as I can use their administrator interface: http://localhost:7474/webadmin/# . CF and Apache are also running fine. I use them daily.
While the code below works, I'd really like to 'see' what's going on using the neo4j web admininistrator. So I can coordinate my learning neo4j while using the data in a CF application.
Code: (Works)
dbroot = "/tmp/neo4jtest1/";
graphDb = createObject('java', 'org.neo4j.kernel.EmbeddedGraphDatabase');
graphDb.init( dbroot & 'var/myFirstGraphDB');
So I tried to connect to the neo4j db graph.db . However the code fails.
Code: (fails)
graphDb = createObject('java', 'org.neo4j.kernel.EmbeddedGraphDatabase');
graphDb.init( dbroot & 'graph.db');
Error:
Object instantiation exception.
An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: ''.
If I remove the "." in graph.db it does create a "graphdb" in the neo4j data folder, and successfully connects to it. However, that db is not viewable with their admin :(
I'm a novice, so please dumb down your answer.
Ok, I think what you're trying to achieve is not possible. It is not possible to access Neo4J within CF (via Java) and have the admin interface working (caveat 1 applies).
If you have put all the jars of the Neo4J package into Adobe CF then most likely the Neo4J admin interface is looking at it's own Neo4J file system. When you create the Embedded server it is not connecting to the same database because it simply can't.
Embedded Neo4J doesn't work like a standard database connection. One Embedded Neo4J reads and writes to one directory location (key word: directory, it doesn't open a single file but a whole bunch of them). No two Neo4J instances can access the same directory location (caveat 2 applies).
Ok, the caveats:
1- it is possible, in theory, to manually start up the admin interface programatically so that it uses the Embedded server that you create via Java. The Java code looks simple enough (taken from Using the server (including web administration) with an embedded database):
// Create your embedded graph db somewhere
src = CreateObject("java", "org.neo4j.server.WrappingNeoServerBootstrapper")
.init(graphDb);
srv.start();
// The server is now running
// until we stop it:
srv.stop();
I did not get this working, mostly because the admin server hasa bunch of dependencies that were incompatible with the rest of my setup, so I can't advise on how well the above will work.
2- it is possible to have 1 read/write Neo4J accessing one location and then have multiple read-only Neo4Js (EmbeddedReadOnlyGraphDatabase) reading the same location (but I've never tried it).
You do have the option of using the REST interface - either manually, or via the Neo4J Java REST Binding (kinda slow, though).
It might be worth reading the Deployment Scenarios documentation before getting too deep in this.
There is at least one CF/Neo4J bridge out there, but it's pretty incomplete. I have one that I worked on, but I need to figure out if I can open source it!
Just a small addition to otupman's comments. I can confirm his theory of connecting to the admin interface from CF. Adding the following jars to the CF class path seemed to be enough to get the basics up and running. You may need additional jars if you are using more advanced features. Note, I am using Tomcat so the exact jars may differ slightly for your environment
neo4j-community-1.7/lib/*.* (entire directory)
neo4j-community-1.7/system/lib: (ONLY the jars below)
asm-3.1.jar
asm-analysis-3.2.jar
asm-commons-3.2.jar
asm-tree-3.2.jar
asm-util-3.2.jar
commons-configuration-1.6.jar
jackson-core-asl-1.8.3.jar
jackson-jaxrs-1.8.3.jar
jackson-mapper-asl-1.8.3.jar
jersey-core-1.9.jar
jersey-multipart-1.9.jar
jersey-server-1.9.jar
jetty-6.1.25.jar
jetty-util-6.1.25.jar
neo4j-server-1.7-static-web.jar
neo4j-server-1.7.jar
rrd4j-2.0.7.jar
Then started the server and database in onApplicationStart
factory = createObject("java", "org.neo4j.graphdb.factory.GraphDatabaseFactory");
dbroot = ExpandPath("/neo4jtest/");
graphDb = factory.newEmbeddedDatabase(dbroot & 'myFirstGraphDB');
Bootstrapper = createObject("java", "org.neo4j.server.WrappingNeoServerBootstrapper");
graphServer = Bootstrapper.init( graphDb );
graphServer.start();
application.graphServer = graphServer;
application.graphDb = graphDB;
And closed both in onApplicationEnd
application.graphDb.shutDown();
application.graphServer.stop();
Edit: After some further testing, I think is better to load them once in OnServerStart. Then use a shutdown hook to close them. But since this is just for a local development box, it is less critical.

C++ Database API's - DTL

I'm looking for a C++ API that is able to connect to different types of databases all in one; mainly MySQL, oracle and SQL Server and I believe I have found one with "DTL" ( http://dtemplatelib.sourceforge.net/ )
However, I'm struggling to connect my database on localhost. Has anyone used this before and could shed some more light on it other than what their site does with
DBConnection::GetDefaultConnection().Connect("UID=example;PWD=example;DSN=example;");
though I guess what to put in uid and pwd, I'm not sure what it's expecting in 'dsn', are there any REAL examples or have you guys used it before and could help.
This is an ODBC library, so DSN is the ODBC data source name. On Windows, these can be configured under Administrative Tools->Data Sources.
As #Dark Falcon said, the "DSN" refers to an "ODBC data source". What you get is an extra level of indirection like this:
On Windows, you normally create the ODBC data source with the "Data Sources (ODBC)" control panel, which is normally in the "Administrative Tools".
In any case, this separates the configuration/deployment "stuff" from the code. For example, if you want to use your code with a test database during development, then with the "live" database when you deploy it, you can do that without making any changes to your code, and even without changing the connection string. Instead, you change the data source to refer to production server instead of the test server.

using libdrizzle as an async mysql connector

I'm interested in using libdrizzle as a generic asynchronous-capable connector for mysql db for a c++ application (actually as a backend for hiberlite). Since early this year libdrizzle is no longer a separate project and its merged in the same drizzle project, so installing as a separate dependency (unrelated to the rest of drizzle) might have become slightly more complex.
I'm wondering if people has used this library for interfacing to MySql or MariaDB, probably make some mickey mouse benchmarks to have a rough idea how it stands relative to the synchronous default driver.
Also, comments on difficulties to install, setup, pitfalls (the documentation is essentially nonexistent) would be greatly appreciated.
You might want to take a look at ngx_drizzle (drizzle-nginx-module) at github.
From module description:
This is an nginx upstream module integrating libdrizzle into Nginx in a non-blocking and streamming way.
Essentially it provides a very efficient and flexible way for nginx internals to access MySQL, Drizzle, as well as other RDBMS's that support the Drizzle or MySQL wired protocol. Also it can serve as a direct REST interface to those RDBMS backends.
If you're using MySQL, then MySQL 5.0 ~ 5.5 is required. We're not sure if MySQL 5.6+ work; reports welcome!

Connecting to oracle database using C++, the basics

i have a question about the theory here, i'm just starting a project which is based on C++ applications integrating with oracle DB's, i've came to two choices, OCCI, and OCI
the OCCI is said to be aimed at C++ environment, but i was wondering, if it would be any good to use the OCI libraries from my C++ app since it is said to have better performance, or would i run into compatibility issues ?
thanks in advance :)
You can have a look at OTL it's a wrapper above the OCI or OCCI (not sure) will give some templates and samples to start with oracle connection in c++.
In my case, my company have about a thousand stores.
To connect Oracle / Oracle thru an MS C++ multi-thread service we perform the following tests on each thread:
Validate DNS (gethostbyname)
Try to open SCManager of the store (OpenSCManager)
Verify if Oracle Service exists on the store (OpenService)
Verify if Oracle Service is running (QueryServiceStatus)
After all, we try to connect (ado->Open)
This procedures minimize possible errors like 0xE06D7363 when connecting to a external server.