I am trying to upload data into an existing table in mysql database, using append. I am able to pull data from that table which means connection should be OK. Here is my code for data pulling with database information:
proc sql;
connect to mysql (server="thisistheserver.com" port=3311
user="username" password="mypassword");
create table want as select * from connection to mysql
(
select *
from databaseschema.existingdata
);
disconnect from mysql;
quit;
Now below is my code to append:
libname DB mysql dsn = "thisistheserver.com" schema=databaseschema port = 3311 uid = "username" password = "mypassword";
proc append base = DB.existingdata data = have force;
run;
It returns error: error trying to establish connection: can't connect to local mysql server through socket
'/var/lib/mysql/mysql.sock' (2)
error: error in the libname statement.
error: libref DB is not assigned.
Please help me on this,
Thanks,
Check you Libname Statement, The SAS/Access Libname to Mysql should be like :
libname mysqllib mysql user=username password=mypassword database=databaseschema server=thisistheserver.com port=3311;
Check you Libname Statement, The SAS/Access Libname to Mysql should be like :
libname mysqllib mysql user=username password=mypassword database=databaseschema server=thisistheserver.com port=3311;
Thanks, now it seems libref is assigned and connection is established.
However, there is a new error in
proc append base = DB.existingdata data = have force;
run;
error: no database selected SQL statement: SELECT * FROM 'existingdata'.
I used append locally before and there was never such an error be seen.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.