The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Can we pass Mysql database name and table name to dynamically through web url using macros?

kamal_pradhankamal_pradhan Member Posts: 3 Contributor I
edited December 2018 in Help
I am getting difficulties in passing the database connection detail to a RapidMiner process deployed as a webservice . I tried to use macros and even after providing correct connection details.

I keep on getting this error

de.rapidanalytics.ejb.service.ServiceDataSourceExceptionError executing process /home/proc_1/test for service test: Database error occurred: Could not connect: Access denied for user 'root'@'static.115.208.216.95.clients.your-server.de' (using password: YES)

Answers

  • Pavithra_RaoPavithra_Rao Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist
    @kamal_pradhan

    Firstly, please check if the credentials you are passing is correct. Because error indicates wrong credentials...

    Could you please give more details here?
    What's the database? Also how exactly your process is setup, like how you are passing the macro value, and in what part of the workflow you are using it. Since you are saying, you are tryng to give database connection details via macros?

    Please share Server error logs, available in following location:
    <server-home-directory>\log\server.log

    Cheers,
    Pavithra
  • curious95curious95 Member Posts: 12 Contributor II
    @Pavithra_Rao

    Hi,

    What I'm trying to active passing the database details (url, username and password) through a created web-service using macro bindings. If I use a predefined connection in the server then the process works but If I try to specify the details through macros and parameters the following error occurs:


    com.rapidminer.operator.UserError: Database error occurred: Could not connect: Access denied for user 'root'@'localhost' (using password: YES)
    Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
    at com.rapidminer.extension.jdbc.operator.io.DatabaseDataReader.getResultSet(DatabaseDataReader.java:115)
    at com.rapidminer.extension.jdbc.operator.io.DatabaseDataReader.createExampleSet(DatabaseDataReader.java:122)
    at com.rapidminer.operator.io.AbstractExampleSource.read(AbstractExampleSource.java:49)
    at com.rapidminer.extension.jdbc.operator.io.DatabaseDataReader.read(DatabaseDataReader.java:89)
    at com.rapidminer.extension.jdbc.operator.io.DatabaseDataReader.read(DatabaseDataReader.java:73)
    at com.rapidminer.operator.io.AbstractReader.doWork(AbstractReader.java:134)
    at com.rapidminer.operator.Operator.execute(Operator.java:1025)
    at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
    at com.rapidminer.operator.ExecutionUnit$2.run(ExecutionUnit.java:812)
    at com.rapidminer.operator.ExecutionUnit$2.run(ExecutionUnit.java:807)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
    at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:428)
    at com.rapidminer.operator.Operator.execute(Operator.java:1025)
    at com.rapidminer.Process.execute(Process.java:1322)
    at com.rapidminer.Process.run(Process.java:1297)
    at com.rapidminer.Process.run(Process.java:1183)
    at com.rapidminer.Process.run(Process.java:1136)
    at com.rapidminer.Process.run(Process.java:1131)
    at com.rapidminer.Process.run(Process.java:1121)
    at com.rapidminer.execution.jobcontainer.execution.SimpleExecutor.executeProcess(SimpleExecutor.java:84)
    at com.rapidminer.execution.jobcontainer.EngineRunner.onApplicationEvent(EngineRunner.java:76)
    at com.rapidminer.execution.jobcontainer.EngineRunner.onApplicationEvent(EngineRunner.java:30)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
    at org.springframework.boot.context.event.EventPublishingRunListener.finished(EventPublishingRunListener.java:101)
    at org.springframework.boot.SpringApplicationRunListeners.callFinishedListener(SpringApplicationRunListeners.java:79)
    at org.springframework.boot.SpringApplicationRunListeners.finished(SpringApplicationRunListeners.java:72)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
    at com.rapidminer.execution.jobcontainer.Application.main(Application.java:46)
    Caused by: java.sql.SQLInvalidAuthorizationSpecException: Could not connect: Access denied for user 'root'@'localhost' (using password: YES)
    Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
    at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:135)
    at org.mariadb.jdbc.internal.util.ExceptionMapper.getException(ExceptionMapper.java:101)
    at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:91)
    at org.mariadb.jdbc.Driver.connect(Driver.java:109)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:208)
    at com.rapidminer.extension.jdbc.tools.jdbc.DatabaseHandler.connect(DatabaseHandler.java:304)
    at com.rapidminer.extension.jdbc.tools.jdbc.DatabaseHandler.getConnectedDatabaseHandler(DatabaseHandler.java:255)
    at com.rapidminer.extension.jdbc.tools.jdbc.DatabaseHandler.getConnectedDatabaseHandler(DatabaseHandler.java:247)
    at com.rapidminer.extension.jdbc.tools.jdbc.DatabaseHandler.getConnectedDatabaseHandler(DatabaseHandler.java:981)
    at com.rapidminer.extension.jdbc.operator.io.DatabaseDataReader.getResultSet(DatabaseDataReader.java:103)
    ... 32 common frames omitted
    Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Could not connect: Access denied for user 'root'@'localhost' (using password: YES)
    Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authentication(AbstractConnectProtocol.java:569)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:503)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:382)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:839)
    at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:479)
    at org.mariadb.jdbc.Driver.connect(Driver.java:104)
    ... 39 common frames omitted


    Thanks



  • MarcoBarradasMarcoBarradas Administrator, Employee-RapidMiner, RapidMiner Certified Analyst, Member Posts: 272 Unicorn
    Try something like this
    <?xml version="1.0" encoding="UTF-8"?><process version="8.2.000">
      <context>
        <input/>
        <output/>
        <macros>
          <macro>
            <key>url</key>
            <value/>
          </macro>
          <macro>
            <key>user</key>
            <value/>
          </macro>
          <macro>
            <key>pass</key>
            <value/>
          </macro>
        </macros>
      </context>
      <operator activated="true" class="process" compatibility="8.2.000" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="jdbc_connectors:read_database" compatibility="8.2.000" expanded="true" height="68" name="Read Database" width="90" x="380" y="34">
            <parameter key="define_connection" value="url"/>
            <parameter key="database_url" value="%{url}"/>
            <parameter key="username" value="%{user}"/>
            <parameter key="password" value="ZGmujF5bm8M="/>
            <enumeration key="parameters"/>
          </operator>
          <connect from_op="Read Database" from_port="output" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
    
    The only problem is that you can't pass the password directly through the macro since is encrypted by the RM core now. 
    @Pavithra_Rao I guess that´s the reason is says the user is not the right one.

  • curious95curious95 Member Posts: 12 Contributor II
    @MarcoBarradas

    I think you correct. I tried with the same step and it works fine in the studio but fails in the server.


Sign In or Register to comment.