Tag Info

Hot answers tagged

12

Here are the two ways I have successfully used MongoDB with Mathematica. AFAIK much of this would also apply to similar DBs such as CouchDB. A. Easy way One working example used a third party Mongo supplier such as 28msec.io and use URLFetch e.g. With this supplier you can both read from and write to the database using HTTP GET and simple query strings. ...


7

You can decompress on the Mathematica side easily. Compressed MySQL reply has the following format: first four bytes are size of uncompressed data (lowest byte first) the rest is the string compressed with deflate algorithm (zlib library) Here is an example of a reply: {10, 0, 0, 0, 120, 156, 243, 72, 205, 201, 201, 87, 240, 170, 112, 82, 4, 0, 19, ...


7

The answer here is found in the comments above: The MySQL query itself takes 1.6-1.7 seconds, so the time spend in Mathematica on this query is negligible and can not realistically be optimized in this case.


5

If you have full control over the MySQL database I think it lets you log every SQL statement from every client (query-log), which probably is the most simple way to get that information. You could also try to look at or even manipulate the sources, it looks like the relevant code is delivered as clear text in the following file in the Mathematica directory: ...


5

Adding a database index is very important when SELECTing data from a big table. Once you add the index, MySQL will take care of keeping it updated. The disadvantage of indices is that your database now takes more space in your HD and that your INSERTs are now slower. Note that you created a multiple-column index that speeds up you SELECTs when you lookup ...


4

You can use this: set = {{0, 0},{1,1},{2,2}} SQLExecute[conn,"INSERT INTO numbers VALUES (?,?)", set] If you want to do just one case, use: set = {{0, 0}} The ? way is the fast one. You can lear a lot in the Database Link User Guide Tutorial that is a nice official material from Wolfram. You can download the pdf for free.


4

In the past, years ago, I have had problems with the MySQL connection that were solved following Wolfram's tech support advice of updating the java connector to its latest version. This can be done by: Download the connector from MySQL web page: http://www.mysql.com/downloads/connector/j/ Install it at ...


3

It looks like you have the answer by added indexes. Note you can check how MySql is satisfying your query using the keyword explain . This will tell you if there are any full table scan going on which will slow down the query enormously depending on the size of the tables. See here for more info.


3

When I have to connect frequently to a database, I prefer to create a pack with the connections strings. BeginPackage["myConn`",{"DatabaseLink`"}] myConn::usage="myConn[ip] with default 192.168.0.20"; Begin["`Private`"] myConn[ip_:"192.168.0.20"] := OpenSQLConnection[ JDBC["Microsoft SQL Server(jTDS)", ip], "Username" -> "my User", ...


3

Mathematica can also connect to Neo4J via the REST API. Instructions for use on OS X: 1. Install Neo4j 2. start the webserver $ sudo apachectl start 3. start Neo4j (installation in usr/local/bin) $ neo4j start 4. Make sure all is working 127.0.0.1:7474 Examples: URLFetch["http://localhost:7474/db/data/node", {"StatusCode", "Content"}, ...


2

I would suggest to use SQL directly. For Oracle databases the following module should work. Module[{dbConn, sqlAct, records}, "SELECT TABLE_NAME,COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME like'%your table name%'"// Set[sqlAct, #] &; OpenSQLConnection["your connection"] // Set[dbConn, #] &; SQLExecute[dbConn, sqlAct] // Set[records, #] &; ...


2

First of all, {#[[1]], #[[2]] } & /@ is superfluous. It's basically taking apart every sublist and reconstructing them again. Your data can equivalently be retrieved like this: totalCntLByCnty = SQLExecute[conn, " SELECT COUNT(*), c.description FROM name_loc f INNER JOIN countries c ON f.fk_cnty_id = c.id INNER JOIN identifiers i ON ...


2

You appear to be facing a problem related to the configuration of MySQL itself. Have you take a look at the MySQL server configurations? It appears to be the value of the wait_timeout property which depending on the installer used defaults to something between 2 and 8 hours. Normally, the server configuration file is called my.cfg and it is located in the ...


1

Here is database connection file to one of my databases. The file can be found on Linux systems in directory: /home/username/.Mathematica/DatabaseResources/mydatabse.m If you can't find mydatabase.m or DatabaseResources directory, try creating them (I assume that path should be similar on Windows?). Here is a config file: ...


1

Check the following Linux parameters. cat /proc/sys/net/ipv4/tcp_keepalive_time cat /proc/sys/net/ipv4/tcp_keepalive_intvl cat /proc/sys/net/ipv4/tcp_keepalive_probes



Only top voted, non community-wiki answers of a minimum length are eligible