Error when inserting data into database without toolbox
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
JFz
el 6 de Feb. de 2017
Comentada: Guillaume
el 6 de Feb. de 2017
Hi,
I don't have database toolbox. But I created a correct connection. I try to use insert function to insert one row into a table, but keep getting this: Undefined function 'insert' for input arguments of type 'sun.jdbc.odbc.JdbcOdbcConnection'. What function should I use if I don't have a toolbox? Thanks for any suggestions.
JF
1 comentario
Respuesta aceptada
Guillaume
el 6 de Feb. de 2017
Why are you using a jdbc to odbc driver? It would only make sense if you were already familiar with the java sql api, which does not appear to be the case here. You may as well connect directly to the odbc driver from matlab.
As far as I know no odbc (or jdbc) driver offer insert methods. You have to build the SQL query yourself. Refer to your database documentation to know the exact syntax. It's usually something like:
sql = 'INSERT INTO tablename (colum_name, column_name, column_name) VALUES (value, value, value)'
connection.execute(sql);
Possibly wrapped in a transaction.
2 comentarios
Guillaume
el 6 de Feb. de 2017
You don't have to use the toolbox (I don't, since I don't have it) but it's significantly more work without.
Más respuestas (0)
Ver también
Categorías
Más información sobre Database Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!