connect to ms access


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting connect to ms access
# 1  
Old 06-13-2011
connect to ms access

I am new to bash scripting,can anyone suggest a way to connect to ms access
through a bash script
# 2  
Old 06-13-2011
If the Access db is running on the network it should have a DSN which will allow you to access it via ODBC.

You could the use the Perl DBI and DBD::ODBC module to make your queries. eg
Code:
#!/bin/bash
results=`perl -MDBI  -e '
   $dbh = DBI->connect('dbi:ODBC:DSN', 'user', 'password');
   $sth = $dbh->prepare("SELECT foo, bar FROM table WHERE baz=?");
      $sth->execute( $baz );    
   while ( @row = $sth->fetchrow_array ) {     
      print "@row\n";   
   }
'`
for result in "$results" ; do
   #process result in some fashion
done

I realise that this looks more like an embedded Perl script than a shell script, however I'm unaware of a command line utility that allows you make DB connections and queries like this.
# 3  
Old 06-13-2011
Not possible using plain shell scripting. You'll need to install unixODBC (if not already available). With that you can access a local MDB file, or one shared through CIFS/Samba, with the help of MDB Tools. If you only have the file available remote, you could either link it to an MSSQL Server, or try creating a ODBC-ODBC bridge (though I've never seen one in a production environment).
# 4  
Old 06-14-2011
tanx guys...Smilie
I'll try it out and update the result.......
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Connect direct - SFTP - List of servers that I can connect

Greetings Experts, I am working for a bank client and have a question on connect-direct and SFTP. We are using Linux RedHat servers. We use connect-direct to transfer (NDM) files from one server to another server. At times, we manually transfer the files using SFTP from one server to another... (2 Replies)
Discussion started by: chill3chee
2 Replies

2. Proxy Server

How to use Squid on Linux to control certain IP to access Web Server and certain IP cannot access?

Dear all experts here, :) I would like to install a proxy server on Linux server to perform solely to control the access of Web server. In this case, some of my vendor asked me to try Squid and I have installed it onto my Linux server. I would like know how can I set the configuration to... (1 Reply)
Discussion started by: kwliew999
1 Replies

3. Cybersecurity

When i start CSF i cant connect VPS or download any data into it It appears i cant connect Linux VP?

It appears i cant connect linux VPS server via SSH or i cant SCP any file to it and i cant wget any file TO it (from inside it) while CSF (Config Server Firewall, LFD is running. Just after isntall in default configuration and after changing TESTING mode to LIVE mode. Trying to wget & install... (1 Reply)
Discussion started by: postcd
1 Replies

4. Shell Programming and Scripting

Connect Perl with MS Access (.mdb file)

Hi Guys, How All are Doing In Perl I am getting an issue that I want to share with all you guys. I have a .mdb file(MS Access) that contain many tables. With the help of Perl I want to Connect that mdb file and after Connecting I want to fire a sql query lets say (select * from Table1). ... (3 Replies)
Discussion started by: adisky123
3 Replies

5. Solaris

samba read write access to owner and no access to other users

Hi All, I want to configure samba share permission so that only directory creator/owner has a read and write permission and other users should not have any read/write access to that folder.Will that be possible and how can this be achieved within samba configuration. Regards, Sahil (1 Reply)
Discussion started by: sahil_shine
1 Replies

6. AIX

AIX Remote Connect Fail With “No more multiple IP addresses to connect” Error

We have a production server at a client site running AIX. And recently when users are trying to connect to it via telnet, it prompts "No more multiple IP addresses to connect". Can I know what does this error mean? and how to rectify this? Thanks. (2 Replies)
Discussion started by: a_sim
2 Replies

7. IP Networking

Does my provider limit my internet access or somesites access?

Hi Good Day, i would like to ask for further info about my problems experiencing this evening. Im a PPP0 connection in the internet using 3G located in asia pacific region.i had this problem this evening in my INTERNET connections that there are some sites i can't open example ( Gizmodo.com,... (2 Replies)
Discussion started by: jao_madn
2 Replies

8. UNIX for Dummies Questions & Answers

kernel giving access for multiple users to access files

hi all, i want to know y kernel is giving access for multiple users to access a file when one user may be the owner is executing that file. Because other user can manipulate that file when the other user is executing that file, it will give the unexpected result to owner . plz help me... (1 Reply)
Discussion started by: jimmyuk
1 Replies

9. UNIX for Dummies Questions & Answers

Need help to access/mount so to access folder/files on a Remote System using Linux OS

Hi I need to access files from a specific folder of a Linux system from an another Linux System Remotely. I know how to, Export a folder on One SCO System & can access the same by using Import via., NFS in the Sco Unix SVR4 System using the scoadmin utility. Also, I know to use mount -t ... (2 Replies)
Discussion started by: S.Vishwanath
2 Replies
Login or Register to Ask a Question