How to use -I backend with Mdb-tools 0.7~rc1-4? - ruby-on-rails

I want to convert ms-access database to sql via mdbtools.
on ubuntu 11.10 32bit with mdbtools 0.5.99.0.6pre1.0.20051109-7.1 when i am using mdbtools -I backend is working fine. i.e. i got file with Insert statement.
but on ubuntu 12.04lts 64bit, mdbtools, 0.7~rc1-4 i am not able to convert mdb file into sql file.
my syntax is :
mdb-tools -I >
please let me know any correction is needed.
Thanks in advance.

mdb-tools -I access shuld work
Supported backends are: access, sybase, oracle, postgres, mysql

Related

sqsh gives "dsp_desc_bind: Memory allocation failure for column #1"

On Ubuntu 18.04 with freetds 1.00.82-2 and sqsh 2.1.7-4build1, I get the following when trying to SELECT foo FROM bar where foo is an nvarchar column:
dsp_desc_bind: Memory allocation failure for column #1
Why does this happen? I see some ancient bug reports, but I can't see any solutions there; this error message is quite ungooglable.
I tried downgrading freetds to 0.91.6, which I had working on Ubuntu 17.10, and then got the more understandable error message
Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.
which led me to the solution:
Edit /etc/freetds/freetds.conf and add a section
[YourDbHostname]
host = localhost
port = 1433
tds version = 8.0
Now it works :)
EDIT: Seems like sqsh-2.5.16.1 ignores this file now? Another solution is to just use the -G argument, e.g. sqsh -G 8.0 -i foo.sql

Connect to heroku apps mongodb (compose) on terminal

I have inherited a Ruby on rails app, which runs on Heroku and has a compose mongoDB. To be clear I have never used ruby, mongo or Heroku and its been a massive learning curve.
I essentially want to get a copy running locally, but more importantly I want to pull down and export the data that is in the db at the moment.
I have installed the latest version of Heroku Toolbelt and I have installed the latest version on mongodb, which also included all 4 packages. Im running this locally on Ubuntu 14 lts.
The documentation I do have says to run this command to log into the db
mongodb://heroku:password-string#tempest.mongohq.com:10098/appid
But if I run just the above it says no such file or directory, if I add 'mongo' onto the beginning then it seems to work but throws the following error
E QUERY Error: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']'; heroku:password-string#tempest.mongohq.com:10098
I did try running it wrapped in [] too.
This is just getting in so I can then export the data locally and then try to look at it.
The command-line mongo tool doesn't understand URLs, so try this instead:
mongo -u heroku -p password-string tempest.mongohq.com:10098/appid
Also I'm pretty sure you can leave off the -p password-string and it will prompt you for it, so you can avoid revealing it in ps output etc.

Execute ms sql server queries from linux terminal

I need to query a MS SQL Server database from a linux terminal. Searching the web and this site I found freetds and then sqsh. I have installed them and seems to connect to the server but I can't get it to execute a query, I'm definitely doing something wrong.
I have configure freetds as:
[MSSql]
host = 192.168.1.4
port = 1433
tds version = 7.0
The databse server is a Sql Server 2008 r2.
When connecting I use the following command:
sqsh -S MSSql -U sa -P sa -D databasename
Which gives me a prompt like:
sqsh-2.1.7 Copyright (C) 1995-2001 Scott C. Gray
Portions Copyright (C) 2004-2010 Michael Peppler
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
1>
Then I try to enter a query like:
1> select * from C_PROPS;
But nothing happens. What am I doing wrong?, just need simple selects and updates.
I think that the semicolon_hack variable is not set.
You need to write your command like this
select * from C_PROPS
go
or, at the beginning of a sqsh session
\set semicolon_hack=on
go
now you can do
select * from C_PROPS;
or, alternatively, create a .sqshrc in your home directory and insert this snippet
#
# $semicolon_hack : This turns on the ability to use a semicolon as
# a sort of in-line go. It is kind of hacky but seems
# to work pretty well.
#
\set semicolon_hack=on

How to browse data in MongoDB in Mac OS?

When I am using PostgreSQL, I am accustomed to use terminal for browsing data stored in DB tables.
Is there any similar way to do it for MongoDB? I have used this topic for MongoDB installation on Mac.
Thanks
MongoDB bin directory contains an executable called 'mongo' which is an interactive shell (similar to 'psql' in PostgreSQL)
You can read more about how to use it HERE.
To get started, you can type
> help
To switch to a specific database, just type:
> use db-name
^^^^^^^ replace with your db name.
> db.help()
> db.collectionName.help()
^^^^^^^^^^^^^^ replace with your collection name
You can do this from any machine not just the one mongod is running on but then you connect via:
mongo hostname:port/dbname
for example
mongo myMongoDBserver:27017/foobardb
First start mongod process in a terminal tab. In other terminal tab or window simply start mongo.
mongod is mongo daemon which establishes connections and listens to requests. mongo is the javascript shell where you can have your interactive mongodb queries.
Rest is best explained in the link #Asya Kamsky provided in his answer.
command 'mongo' will open mongo shell for you, there you can use database commands

How to dump data from mysql database to postgresql database?

I have done the depot application using mysql... Now i am in need to use postgres... So i need to dump data from mysql database "depot_development" to postgres database "depot_develop"...
Here you can find some interesting links http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#MySQL
Have you tried to copy the tables from one database to the other:
a) export the data from MySQL as a CSV file like:
$> mysql -e "SELECT * FROM table" -h HOST -u USER -p PWD -D DB > /file/path.csv'
and then,
b) import it into Postgres like:
COPY table FROM '/file/path.csv' WITH CSV;
This question is a little old but a few days ago i was dealing with this situation and found pgloader.io.
This is by far the easiest way of doing it, you need to install it, and then run a simple lisp script (script.lips) with the following 3 lines:
/* content of the script.lisp */
LOAD DATABASE
FROM mysql://dbuser#localhost/dbname
INTO postgresql://dbuser#localhost/dbname;
/*run this in the terminal*/
pgload sctipt.lisp
And after that your postgresql DB will have all of the information that you had in your MySQL SB
On a side note, make you you compile pgloader since at the time of this post, the installer has a bug. (version 3.2.0)

Resources