How to pass database name to datainsert in case of using ODBC?

1 visualización (últimos 30 días)
I had memory problems when using JDBC so now I want to use ODBC but I don't know where to pass the database name. I'm getting this error [MySQL][ODBC 5.3(w) Driver][mysqld-5.5.5-10.1.21-MariaDB]No database selected
The connection is successful though username=''; pwd=''; conn = database('MySQL_ODBC',username,pwd); >> conn.ping
ans =
DatabaseProductName: 'MySQL'
DatabaseProductVersion: '5.5.5-10.1.21-MariaDB'
JDBCDriverName: 'JDBC-ODBC Bridge (myodbc5w.dll)'
JDBCDriverVersion: '2.0001 (05.03.0009)'
MaxDatabaseConnections: 0
CurrentUserName: '?'
DatabaseURL: 'jdbc:odbc:MySQL_ODBC'
AutoCommitTransactions: 'True'
conn
conn =
database with properties:
Instance: 'MySQL_ODBC'
UserName: ''
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 sun.jdbc.odbc.JdbcOdbcConnection]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'

Respuesta aceptada

Nairouz Mohamed
Nairouz Mohamed el 17 de Ag. de 2017
Editada: Nairouz Mohamed el 17 de Ag. de 2017
I figured it out the data source name has to be the same as the database name. Now I am getting another error when trying to use datainsert but it is more like a warning coz when i checked the database the data is inserted just fine.
java.sql.SQLException: SQL Exception : Conversion not supported by setObject!! at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.emulateExecuteBatch(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeBatchUpdate(Unknown Source) at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch(Unknown Source) at com.mathworks.toolbox.database.writeTheData.cellWrite(writeTheData.java:284)

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by