If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Informix Database - Batch file to delete records

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-02-09, 03:13
jaisonlucas jaisonlucas is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
Informix Database - Batch file to delete records

Hi,
I am very new to informix db ver 10. I have worked on Sqlserver before but not on informix.
I have a informix database and I am able to make a sucessful ODBC connection to the database. Using Access Linked tables, i am able to view the records of the database.
What I need is to create a batch file to delete certain records from a table and periodically run it. I want to know the content of the batch file.
I know how to do the same in MS SQLServer db using the osql but not aware of it in informix.
Reply With Quote
  #2 (permalink)  
Old 03-02-09, 06:17
rootdbs rootdbs is offline
Registered User
 
Join Date: Feb 2009
Posts: 51
Operating system?
Reply With Quote
  #3 (permalink)  
Old 03-02-09, 06:32
jaisonlucas jaisonlucas is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
Operating System is Win2k3 server
Reply With Quote
  #4 (permalink)  
Old 03-02-09, 07:43
rootdbs rootdbs is offline
Registered User
 
Join Date: Feb 2009
Posts: 51
Quote:
Originally Posted by jaisonlucas
Hi,
What I need is to create a batch file to delete certain records from a table and periodically run it. I want to know the content of the batch file.
I know how to do the same in MS SQLServer db using the osql but not aware of it in informix.
If I understood you.

You need to create sql file with DELETE statement, for example,
DELETE from my_table WHERE my_col='bla-bla-bla'
Maybe you will have more complexer statement.

And create batch file. This batch file should has Informix environment such as
set INFORMIXDIR=your_dir
set INFORMIXSERVER=your_server_name
set ONCONFIG=ONCONFIG.your_server
set PATH=c:\ISM\2.20\bin;C:\Informix\bin;%PATH%
set CLIENT_LOCALE=your_locale
set DB_LOCALE=your_locale

maybe more
and next string
dbaccess your_database your_sql_file

And you can add this batch file to Windows scheduler.
Reply With Quote
  #5 (permalink)  
Old 03-08-09, 03:24
jaisonlucas jaisonlucas is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks for the reply. You r right.I tried the above. I was not able to find values for
Set CLIENT_LOCALE=your_locale
set DB_LOCALE=your_locale
i ignored those two strings but then got a conenction error. I think there should be a string where the authentication to the server/database will be done like it is done while using DbAccess and accessing the table and deleting the required records.
Please help.
Reply With Quote
  #6 (permalink)  
Old 03-08-09, 12:24
rootdbs rootdbs is offline
Registered User
 
Join Date: Feb 2009
Posts: 51
jaisonlucas, post your error by copy/paste.
Reply With Quote
  #7 (permalink)  
Old 03-09-09, 05:10
jaisonlucas jaisonlucas is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
Attached batch file and the error msg shotscreen.

Thanks.
Attached Files
File Type: zip delrec.zip (33.2 KB, 96 views)
Reply With Quote
  #8 (permalink)  
Old 03-10-09, 03:32
rootdbs rootdbs is offline
Registered User
 
Join Date: Feb 2009
Posts: 51
Error -387
No connect permission.
You cannot access the database that this statement requests because you have not been granted CONNECT privilege to it. Contact a person who has Database Administrator privilege to that database and ask to be granted CONNECT privileges to it.

First of all you need connect privileges.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On