Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




C- Program To Write To Myi , Myd File


is it possible to create a myi, myd file for mysql using a C program. I
am using Stata that is written in C API, and I want to write the data
out to MYSQL database. Using ODBC and loading the data in MYSQL from
STATA takes forever. Can anyone please tell me if I can create the myd
files by using the data in memory thru C programming.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can't Write To File
Using MySQL 4.1.11-max on OS X 10.3. Using command line.
Can't successfully use "INTO OUTFILE". Getting the following:
mysql> select *
-> into outfile '/users/steves/desktop/test.txt'
-> fields terminated by ','
-> from industry;
ERROR 1 (HY000): Can't create/write to file '/users/steves/desktop/test.txt' (Errcode: 13)
At the shell, I get this:
steves2ndmac:~ steves$ perror 13
OS error code 13: Permission denied

Newbie in both Unix shell and MySQL. Can anyone tell me how to set permissions for Unix User mysql?

Redirect Out Of Mysql Client Program To A File
I have mysql on MS Windows2000.

I like to redirect the output/error messages of MySQL client programs to a file.
For example, when I execute:

"mysql --user=root --password=[wrongpaswd] --silent --database=mysql > errfile"

The following error message is coming in the screen, not in 'errfile'

"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"

I also need to capture the same for utility "mysqlimport".

How capture the output of these client programs in a file?

Re-write Text File
i'm creating a log file regarding database operations. My problem is i want to append a new record into the log file each time i update my database. Previously I've used the following method to create a file:

SELECT * INTO OUTFILE 'c:/"+fileName[i]+" '
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '
'
FROM "+tableName[i]+";

MY problem is I cannot re-use the file created. Is there any way to call the same file for the purpose of re-use. Or maybe the OUTFILE do not allow file created to be re-use.

Create/write To The File
I am working on Solaris and seem to get the following error
Cant create/write to the file '/home/dslab456/temp/tempoutput.lst'
As in windows i cannot specify which drive it is or so ? could anyone help me out with this ?

SELECT * INTO OUTFILE '/home/dslab456/temp/tempoutput.lst'
FROM stocklist_vokus s,p_tmpr p
WHERE s.STOCKLIST =p.stocklist_value
ORDER BY p.rid



Edited 1 time(s). Last edit at 02/12/2007 05:38AM by summer queen.

Can't Create/write To File In C:windows
I installed the 3.51 ODBC driver on a new test machine that is re-imaged each night to a clean OS (Win XP Pro SP2). We place our developer daily builds on this machine and run some automation.

In the automation process, MYSQL statements are ran. The issue I get is that sometimes it stops with this error:

"Can't create/write to file 'C:WINDOWSTEMP#sql_1808_0.MYD' (Errcode: 13), #-2147217871"

or it will run right away, or sometimes it takes 3 tries before it finally gets past whatever it is choking on. I do not have MYSQL installed on that machine, only the driver.

I have given the "Everyone" account full permissions, but still no luck.

Any suggestions? The environment variable on the machine is set to C:WindowsTemp and it appears to execute some statements before, just is stops on some.

Can't Create/write To File /var/run/mysqlid/mysqld.pid
I have installed mysql(mysql-standard-4.1.14-unknown-linux-gnux86_64-glibc23.tar) on linux.but when i tried to start mysql i am getting an error
can't create/write to file /var/run/mysqlid/mysqld.pid
can't start server can't create PID file :No such file or directory.

Mysqldump: Got Errno 27 On Write. File Too Large
I have musql 4.1.7 on Solaris 9, 64 bits and I want to mysqldump a +-4 gigas db.

The dump I want to do is from a myISAM tables databank. I used to do that dump wihtout any problem until recently while the size of the Db double (+-2 to +-4) Code:

MySql OUTFILE, ERROR 1 (HY000): Can't Create/write To File
I have problems in exporting tables to a file in MySql using OUTFILE option. MySql machine is a remote one. I got the error

ERROR 1 (HY000): Can't create/write to file '/tmp/scshekaran/bcp_table.txt' (Err 2)

Search And Write, Or Write And Recover?
The problem: I need to generate a 'unique string' for each row in a table. I already use auto_increment for system dependencies between tables.

What is the best approach one of these or another?

After generating a candidate 'unique string' the two strategies that came to mind are:

1. to then search the table's column to see if it is already assigned; locking the table for write while searching and writing the new row, or

2. set the column to UNIQUE when defining the table. Just go ahead and write the new row if you get a "non-unique" exception, generate another 'unique string' and try again.

I've tried both on a small XP laptop and get "lock timeout exceptions" rather quickly using #1. But replace those with lots of re-writes when there starts to get "collisions" of 'unique string's.

MYSQL In A Program
How would I access a database from a program? All I need to connect in the program is the IP address or the URL, though I do not know how to get those from a database.

Also, I'm still having trouble with this:
http://forums.mysql.com/read.php?10,141978,141978#msg-141978

Mysqlimport Program
I have been using load data in file command until recently on a windows machine - works fine.

we are now using a Netware 6.5 box and are trying to use mysqlimport from the command line.

I am using:

mysqlimport --password=123456789 --fields-optionally-enclosed-by="" --fields-terminated-by="," 0608c sys:mysqlinstirling.txt

to import a CSV text file into the database 0608c.

the data looks like this

"2007-06-28 16:07:00",0,13.58,15.77,-13.35,-12.69,-13.36,-6.61,-3.821,......

when the program executes it seems to give the desired results except the timedate is all zeros...

Extraction Program
I am looking for a simple extraction/load program to load data daily from a
Progress 8.3B database via ODBC to a mysql 3.23.57 database. It does not
necessarily need to do any data-type transforms. It need to run on Windows
2000 and be able to run it as a service, or as a cron task if running under
Unix.

Setup Program
I'm writing a Java setup program for installing a JDBC app, which connects to a Mysql database.I want to create a script in order to provide final user setting privileges in that database and add it a table, without needing to write Mysql commands.
How can I do it ?

DB Modelling Program
Is there a database (ERM) modelling program for Mac OS X that can handle MySQL? Maybe a freeware one?

Php Email Program
Does anyone know of a php or even cold fusion based script out there for
accessing email that can be customized? Right now I use SquirrelMail
which is great, however, you can't really customize it to tie in with
your web site. Is there something out there that is very flexible that
I could make fit right into my site which is pretty reliable in terms of
web email?

Php Email Program
Does anyone know of a php or even cold fusion based script out there for
accessing email that can be customized? Right now I use SquirrelMail
which is great, however, you can't really customize it to tie in with
your web site. Is there something out there that is very flexible that
I could make fit right into my site which is pretty reliable in terms of
web email

Using MySQL To Input Into Another Program
I have been working on a workaround to see if I can figure out how to get DATA from MySQL into another program. The other program is built on MS SQL server. The problem is that it is so bloated that a remote and my computer at the plant cannot correspond back and forwards. It takes approximately 10 minutes to key an order in to the remote plant.

I was working on a much smaller database through MySQL and using OpenOffice.org as the front end. I just wanted to go a step further and see if there was a way to use a triggering mechanism of some sort to input the data from OOo/MySQL to the actual program the company uses.

Can't Update A Field From VB Program
I've just setup MySQL on a Linux machine and I'm using Visual Basic in
Windows to connect to it (using MySQL ODBC 3.51 driver). Everything works
fine for browsing the database (used for stock control), but some parts of
the VB program refuse to update the database. It was using an Access
database (which worked ok) and I'm using the same SQL statement and table
structure. Code:

Trigger To Run An External Program
Can I trigger an external program to run when a new record is added to
the mysql table?

The external program is in C and instead of scanning the table
continuously for new insertions, it will be better if an external
program could be triggered.

Good Program For Mysql
Do you now a good program for mysql admin like phpMyAdmin, than better!!

Can't Update A Field From VB Program
I've just setup MySQL on a Linux machine and I'm using Visual Basic in
Windows to connect to it (using MySQL ODBC 3.51 driver). Everything works
fine for browsing the database (used for stock control), but some parts of
the VB program refuse to update the database. It was using an Access
database (which worked ok) and I'm using the same SQL statement and table
structure.

Here's the SQL statement that VB runs:

SELECT Stock.GJGStockCode, Stock.PartName, Stock.Discontinued,
Stock.UnitsInStock, Stock.UnitsOnOrder, Stock.ReorderLevel,
Stock.ReorderQty, StockSuppliers.SupplierID,
StockSuppliers.OrderCode, StockSuppliers.PackQty,
StockSuppliers.Price, Stock.PartsToOrder
FROM Stock, StockSuppliers
WHERE Stock.CurrentSupplier = StockSuppliers.Position AND
Stock.GJGStockCode = StockSuppliers.GJGStockCode AND
((Stock.UnitsInStock + Stock.UnitsOnOrder <= Stock.ReorderLevel)
OR
(Stock.PartsToOrder > 0))
ORDER BY StockSuppliers.SupplierID, Stock.GJGStockCode

....which works ok for browsing the database. If I change the
Stock.PartsToOrder field in the VB program, when VB trys to update it I get
the error message "Insufficient key column information for updating or
refreshing". The Stock table has a primary key (GJGStockCode), and the
StockSuppliers table has a primary key (UniqueID) which is an auto_increment
bigint.

Does anybody know what I need to do to allow VB to update the database? Or
is this a VB question!?? - Although the same SQL statement works with an
Access database.

Linking C Program With Mysql API
I'm linking a simple C code with mysql. I compile the code with
this command:

linux> gcc -L/usr/lib/mysql -I/usr/include/mysql sqlTest.cpp -lmysqlclient -lsocket -lnsl

But it complains that "-lsocket" cannot be found. So, I removed "-lsocket" and
try again, then I got the messages like

/tmp/ccIelMdT.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
/usr/lib/mysql/libmysqlclient.a(my_compress.o)(.text+0x66): In function `my_uncompress':
/usr/src/packages/BUILD/mysql-5.0.27/libmysql/my_compress.c:85: undefined reference to `uncompress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o)(.text+0x11c): Infunction `my_compress_alloc':
/usr/src/packages/BUILD/mysql-5.0.27/libmysql/my_compress.c:58: undefined reference to `compress'

My system is SUSE Linux 9.1, and I installed mysql by downloading the rpm files
from this site, and use "rpm -i mysql-xxxx.rpm" to install them. The libraries
are installed at /usr/lib/mysql, and include files are at /usr/include/mysql.
Can anybody tell me how I can configure my system to make it work?

Program MySQL With Apache
I don't even know what this is called, but I'm looking for a free tool that allows me to code MySQL and will work with Apache and PHP.

Program Refusing To DROP DB
I am getting this problem over phpmyadmin and also over a preprogrammed php script.
When there are more than 30 or 40 selected DBs the programs refuse to carry out any command when I click on the drop button.
They would just take as if there is no command issued at all.....

Anyone know how to make it delete more DBs at one time?
I looked at trhe my.cnf file but don't see any options to do this...
It however runs on small batches but I need it to drop a lot more databases at one time.

Program To Optimise Mysql Queries
Basically im looking for a program that will take input (my query) and produce an output with a much nicer, more efficient query. I have seen sql programs that do this sort of thing, but nothing for mysql.
Just wonder if there is any programs that i have missed? Tryed Toad for mysql, but that wasnt what i wanted, i dont want a program to admin a mysql database, simply to produce a more efficient query.

PROGRAM TO UPDATE DATA TABLES
I need to be able to DELETE selected record & LOAD DATA from a text file or Foxpro table, from a program that can run continuously.

I've tried Foxpro, but FoxPro views are too slow. I have also tried issuing these command from Foxpro with an ODBC connection established, but that does not work at all.

The object is to remove all records for a member and replace these records with records from a new file.

Each transaction will be up to 50,000 records.

I need to execute 2 commands:
DELETE FROM parts WHERE parts.member_id="xxx"
and
LOAD DATA INFILE 'd:/xxx.txt' INTO TABLE parts

Packaging A MySQL Database With A Program
In writing a visaul basic database program with Access as the database you simply copy the database file into the packager and it is installed with your program on the target machine. I am guessing that with mysql, since it is a 'server' program, it is not that easy. Am I wrong? And where would I find information on this.

I have been working on a business accounting program and am a long way from finished, but I wanted something more robust than access as the database. I just need to know how to get the database to the target machine with my program.

How To Access MYSql From External Program
I have a Mysql database on a webserver and would like to access order information automatically from my home computer. I have the ecommerce software send me an email of the order and I wrote a VB program to extract the information from the email and populate an Access database. There must be a better way. Can I somehow have MS Access backup that database on my home computer?

Displaying TEXT Datatype With C Program
I'm currently trying to display the contents of a field which datatype
is set to TEXT, I'm trying to output this through a C program.
the line is as follows:

while((row = mysql_fetch_row(result)) != NULL)
{
printf("SID: %d Sensor: %s",(row[1] ? row[1] : "NULL"));
}

I have trued %c and %s in to print the Sensor name, however %s
crashes the program and %c produces a smiley face.

Displaying TEXT Datatype With C Program
I'm currently trying to display the contents of a field which datatype
is set to TEXT, I'm trying to output this through a C program.

the line is as follows:

while((row = mysql_fetch_row(result)) != NULL)
{
printf("SID: %d Sensor: %s",(row[1] ? row[1] : "NULL"));
}


I have trued %c and %s in to print the Sensor name, however %s
crashes the program and %c produces a smiley face.

Another Program To Access MySQL Database
I have a list of 8 rows by 11 columns that I exported from Excel into MySQL to populate my Database and that all made it through.

I am now trying to create a label with a label making program that will connect to a database. I have installed the ODBC 3.51 driver and tested the link and it finds the file.

When I try to open the database file from the label making program it says "Error Reading Record Fields", I click on details and it says "ODBC driver does not support dynasets."

I have no idea what a dynaset is or why it is an error???
Is there a way around this?

I can save the excel file as a DBaseIII .dbf file and it works but I wanted to be able to use a database for better tracking of information.

MySQL Admin Program/Script
I'm looking for an application, or php script that makes entering and retrieving information out of a database automated. The process would like so:
I enter in the mysql un/pass etc. and create tables and rows. Also defining what type of input each row should have. Whether it be a checkbox, a dropdown menu, plain text input. Also defining what options for things like the checkboxes and dropdowns.
After that, you would be able to go to a simple front end that had the inputs you defined. You could create your entries and retrive them. Sorting them how you see fit.
Given the obvious use for such a thing, there must be plenty. I must not be wording my searches correctly though. I would prefer something free/open source.

Create A C++ Based Program Using Mysql Odbc.
I want my software to be independant of operation system and databases.

That's why I want to use odbc, and don't want to use MFC.
Here I have some questions to ask:
1. On unix (like sun solaris), does there exists any kind of midware
like odbc?
2. I search on the internet, and find most of the examples are based on

PHP. Is there any c++ examples?
3.Once I chose odbc, does that mean that whatever kind of database I
would use later, I don't have to change my source code?
4. now I program on window xp platform. If I use odbc, when impliment
my program to a unix platform, do i have to rewrite my code?

I just started this project, and I'm a newbie. The problems may be a
little bit of stupid.
Can you guys give me some information about this topic?

Developing Database Program Using Delphi And MySQL
how I can use MySQL with Delphi? What I'm really looking for is a header file which can be used in each project which will allow me to use MySQL.

Displaying MySQL TEXT Datatype In C Program
I'm currently trying to display the contents of a field which datatype
is set to TEXT, I'm trying to output this through a C program.

the line is as follows:

while((row = mysql_fetch_row(result)) != NULL)
{
printf("SID: %d Sensor: %s",(row[1] ? row[1] : "NULL"));
}

I have trued %c and %s in to print the Sensor name, however %s
crashes the program and %c produces a smiley face.

Making Connection To Mysql From A C Program On Windows
can any one please tell me "how to make a conncetion to mysql database
from a C program on windows " .
Please help me by giving possible code for making a
conncection,selecting data etc.
i.e. what library files i need to include,what are the functions needed
to be called.

Create My Own VB Backup Program For A Remote MySQL DB
I understand that the basic principles to create a TCP/IP backup program for

a remote MySQL DB are:

a) Query/retrieve the schema.

b) Query/retrieve each table and create inserts for each row of data.

The way I want to do it is even more basic, as I know what my schema is so I

only need to reterieve and create the insert rows to put into my backup text

file, which is basically a large DDL.

The problems that I am experiencing are I want to keep the schema in an

external text file so that I'm not storing it in the actual app and I

thought I would also have another external file to store each 'select * from

tablex' query.

Is this a good way of doing it?

How would I merge the results together to make a new (and 3rd) external text

file backup?

Data On Separate Drive From Program Files
I have a server that I want to run MySQL on.  The server has a 6.4gb hard drive for the OS and applications and a raid array for data that is shared via samba.

What I want to do is install MySQL on the 6.4gb hard drive but have all the DATA saved to the raid array.

Help Me Write This Join?
Hi there, been ages since I wrote any sql, and I'm a little stuck but I figure this is easy for you folks. I have this original query:

$posts = $wpdb->get_results("SELECT ID, post_title FROM " . $wpdb->posts . " WHERE post_status='publish' ORDER BY post_date DESC");

And this gives a lists of all posts. However, I want to only grab posts by a certain category now, say category #9. This information is kept in an intersection table called wp_post2cat. The columns in that table are:

rel_id
post_id
category_id

category_id is what I want, and post_id is the key pointing back to the original post. Posts can have multiple categories, but I just want the one listing where it's category 9, which is audio.

So pseudocode would be something like:

SELECT all posts WHERE post_status equals "publish" and the category is equal to audio (9).

How To Write This Select?
I'm having some troubles writing a select. I have the following tables:

theater
-------
- id
- name

movie
-----
- id
- name

showtime
---------
- id
- theater
- movie
- from
- to
- schedule

I would like to list all the theaters with all the available showtimes and movies. I tried to, but i didn't get the result i was expecting. Can somebody help?


Best Way To Write This Query
Query 1: obtains results in boolean mode from products table based on keywords

Query 2: Would like to grab all manufacturers names from manufacturers table based on mf_id in products table to then create a brand filter.

What is the best way to do this in the most efficient query possible.

I was thinking of building a php array from query 1 of mf id's and the putting them in query 2 and separating them using OR operators.

any ideas?

here is the query fyi:

PHP

$sql =  "SELECT products_id as prodid,
                    products_name as name,
                    manufacturers_id as manufacturers_id,
                    products_price as price,
                    products_msrp as msrp,
                    products_date_added as pda,
                    products_status as status,
                    products_sku as sku,
                    products_weight as weight,
                    categories_id as cat_id,
"
        .boolean_sql_select(
            boolean_inclusive_atoms($search_string),
            $fulltext_key)." as relevance
"
        ."FROM $table_name
"
        ."WHERE
"
        .boolean_sql_where($search_string,$fulltext_key)."
"
        ."HAVING relevance>0
";
        
        
        
        if (isset($HTTP_GET_VARS['sort'])) {
            if ($_GET['sort']=="brand") {
            $sql.="ORDER BY products_name ";
            } elseif ($_GET['sort']=="size") {
            $sql.="ORDER BY products_weight ";
            } elseif ($_GET['sort']=="price_low") {
            $sql.="ORDER BY products_price ASC ";
            } elseif ($_GET['sort']=="price_high") {
            $sql.="ORDER BY products_price DESC ";
            } elseif ($_GET['sort']=="fav") {
            $sql.="ORDER BY products_name ";
            }
            
        } else {
            $sql.="ORDER BY relevance DESC
";
        }

How To Write This In MySQL?
I Want to check if a certain value doesnt exist in a ceratain field in
my table as a condition.

"select id from employees inner join
translog on employees.emp_id=translog.empid
inner join outofofficedays on
employees.emp_id=outofofficedays.emp_id inner join holidays
where (here is my question: &#55614;&#57159;-04-02'
doesnt exist in the column translog.vtransdate)
and (&#55614;&#57159;-04-02' not between holidays.H_START and H_END)
order by translog.vTransDate,employees.emp_id limit 1"

How Do I Write This Trigger?
I’ve been searching all over for the answer to this one. If you have the answer, it would help me out a lot!

Using MySQL triggers, I want to sync content between two tables; I have table “user” and table “users”, each have similar columns “last_name” “first_name” “user_id” …etc, and when a row gets written to table “users”, I wanted that record to be replicated and inserted to “user” (with all the same field info).

How do I write this trigger? I know, it’s anti-normalization, but it will really help me out with testing one of our site's authentication.

Write A Mysql Db Onto A Cd
how to write the db of a mysql on one system onto a cd so as to copy that db to the mysql on another system.
The 2 systems are not connected to each other.

Cant Write Or Delete
I cant get my php script to insert or delete records into a mysql
table. I can view them all fine but that's about it. I've checked
the user permissions on mysql and have set them all to 'Y' incase that
was the problem but still no joy. Can anyone suggest what the problem
may be? I'm tried the usual RTFM but cant spot the problem

Write Data To Row With Via C API
I have an app written in C that sends data to text files. The files receive 8 variables and look like this:

May 19 20:42:09 2002
7
Services
3.23
4.34
0
None
2.31

Rather than writing data to a text file, I need that data to go to a MySQL 5.0.41 database row. I've already got the C API working and connecting to the "localhost" database, but now I need to write data with each transaction. Optimally, I'd like to send the data directly to the database row, but there doesn't seem to be an INSERT statement to do that. What's the best method to write the data to the database directly?

Problem: Displaying MySQL TEXT Datatype In C Program
I'm currently trying to display the contents of a field which datatype is set to TEXT, I'm trying to output this through a C program.

the line is as follows:

while((row = mysql_fetch_row(result)) != NULL)
{
printf("SID: %d Sensor: %s",(row[1] ? row[1] : "NULL"));
}

I have trued %c and %s in to print the Sensor name, however %s crashes the program and %c produces a smiley face.

Sql Server Not Showing In The Program Files Of Start Menu
I installed sql server in december 2005 and when I look at the control pannel, its there. But its not showing on the desk top or even in the start > program files menu. So how can I start it?

How To Write Like Comparison In Procedures?
this sample procedure takes in an username, searches for number of entries matching the pattern of the username.

delimiter $$
create procedure sampleDB.sampleProcedure( IN m_username varchar(30), OUT m_username_matched_count int )
deterministic
begin
if length(m_username) = 0 then
set m_username = 'jason' #set temporary name if empty
end if

set m_username_matched = 0; #finds number of matches for the given username

select
count(*) into m_username_matched #store into the variable to be returned
from
sampleDB.sampleTable
where
userName like '%m_username%' #this is the statement that does not work#

end$$


Copyright © 2005-08 www.BigResource.com, All rights reserved