[R-sig-DB] adding to a MySQL database from within R?
Spencer Graves
@pencer@gr@ve@ @end|ng |rom @tructuremon|tor|ng@com
Sat Oct 9 15:44:16 CEST 2010
Hi, Sean and Jack Tanner:
It's hard to RTFM when I don't know which FMTR. Thanks to you
both for helping me overcome this problem.
1. Before I submitted this question, I read the help page
for "dbWriteTable". Unfortunately, I missed the "append" argument. In
this case, I RTFM without seeing what was there!
2. Jack's suggestion led me to try "RSiteSearch('MySQL
INSERT')". This led me to a vignette written by Brian Ripley for the
RODBC package. I tried other searches without getting an answer. Also,
I had previously seen a post where Ripley recommended the RODBC
package. However, my previous searched did not help me figure out how
to get started with it.
Best Wishes,
Spencer
On 10/9/2010 5:47 AM, Sean Davis wrote:
> On Sat, Oct 9, 2010 at 12:00 AM, Spencer Graves<
> spencer.graves using structuremonitoring.com> wrote:
>
>> Hello, All:
>>
>>
>> How can I add rows to a MySQL database?
>>
>>
>> I can do it manually within MySQL server 5.1.50-community. I can
>> connect to it using the RMySQL package. When I tried "dbReadTable
>> {DBI}", I got a warning that "table headers exists:
>>
>>
>> > MySQL.<- MySQL()
>> > MySQLcon<- dbConnect(MySQL., user=User, password=pw, dbname=myDB)
>> > dbWriteTable(MySQLcon, 'headers', a.data.frame)
>> Warning message:
>> In mysqlWriteTable(conn, name, value, ...) :
>> table headers exists in database: aborting mysqlWriteTable
>>
>>
>> I know that table "headers" exists: I want to add to it, not
>> create the entire table from scratch at once.
>>
>>
> See the help for dbWriteTable(). In particular, check out the append
> parameter.
>
> Sean
>
--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph: 408-655-4567
More information about the R-sig-DB
mailing list