I'm trying to connect to a local MySQL database, with the anylogic object "database".
I'm using the type: "Other Database", and the connection URL: "Server=localhost;Database=anylogicdata;"
but I constantly get a RuntimeException saying: "not suitable driver found"
The help file says that you have to install the driver, but i don't know which or if it is my connection URL that is the problem.
Does anyone have some pointers to help me along the way?
You need a JDBC driver to be able to connect to a MySQL server from Java (that AnyLogic is based on) and you can find one here. After you have installed the driver you should find it in the list of available JDBC drivers in AnyLogic. The name should be com.mysql.jdbc.Driver if you chose the suggested one.
First you have to download and add the mysql-connector-java-*.jar file to the anylogic-project.
Then you have to type com.mysql.jdbc.Driver into the JDBC driver dropdown box. finally the connection string should look something like
jdbc:mysql:[host/db]?:[port]
another thing I found that might be helpfull to others, is that you can get the java connection from the anylogic db object: database.getConnection() this is very usefull if you want to create your own query. eg create a bulk insert instead of the single insert that Anylogic provides.
Related
I am trying to use Apache drill GUI on windows 10, I have followed all the instructions on their link https://drill.apache.org/docs/using-jdbc-with-squirrel-on-windows/ , adding the driver shows the message Driver class org.apache.drill.jdbc.Driver successfully registered for driver definition: test but when creating an alias and testing the connection, it says
Drill JDBC Driver alias: JDBC Driver class not found
class java.lang.ClassNotFoundException: org.eclipse.jetty.server.Handler
I have also tried adding the E:\apache-drill-1.16.0\jars\3rdparty and E:\apache-drill-1.16.0\jars\classb folder paths when adding the driver. But in vain, please help me in this regard.
Please use connection string to connect to Drill instance instead of using a connection string which tries to start Drill in embedded mode: jdbc:drill:zk=local. For example, you may start Drill in embedded mode using drill-embedded script or using sqlline, as was described here: https://drill.apache.org/docs/starting-drill-on-windows/ and connect to it using jdbc:drill:drillbit=localhost connection string.
Regarding the correct error message, squirrelsql handles exceptions in their own way, but it is possible to make changes in Drill to enforce squirrelsql to specify the correct exception. I have created Jira for this: https://issues.apache.org/jira/browse/DRILL-7461
I'm trying to establish a connection between Cloud SQL and Data Studio. I've already tried to make a connection through the MySQL connector with a MySQL db and it failed because I think the Router did not allow the connection.
Then I transferred the db on the cloud but I have the same error!!! Which is:
ID errore: f73c5f49
I already opened Cloud-SQL to all the Data Studio IP addresses, I've created users with "%" and given them all the privileges, I created instance, db and user in CLOUD-SQL (MySQL, 2nd generation).
What else can I try? Could it still be a Router problem?I have to do that for work but it keeps saying that connector parameters are wrong.
PLEASE HELP <3 THANKS A LOT
A common error is to write the instance name instead of the "instance connection name".
You can find the "Instance Connection Name" in the instance page, in the overview section, and normally the format is something like:
[PROJECT_ID]:[region]:[NAME_SQL_INSTANCE]
I also had a similar connection problem with MySql 8.0 but changing to 5.7 fixed it.
Before I begin, I'd like to start by saying I am completely new to Kafka and am fairly new to Linux, so if this ends up being a ridiculously simple answer, please be kind! :)
The high level idea of what I'm trying to do is use Confluent's Kafka Connect to read from a MySQL database that is having sensor data streamed to it on a minute or sub-minute basis and then use Kafka as an "ETL pipeline" to instantly route that data to a Data Warehouse and/or MongoDB for reporting or even tie in directly to Kafka from our web-app.
I am using Robin Moffatt's series as well as Confluent's JDBC Source Connector Quickstart as my initial guide. As far as where these are hosted, I am using an Amazon RDS MySQL database and a separate AWS EC2 t2.large instance with Ubuntu 16.04.2 to run Kafka Connect.
Using Robin's workflow, I am to the point where I have created the configuration file, but I am not using the json format he uses. I am using the format from the quickstart article.
name=jdbc_source_mysql_4427_Data
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://localhost:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://localhost:8081
connection.url=jdbc:mysql://lndbtest.cdveaddpnevv.us-east-2.rds.amazonaws.com:3306/LNDBv1?user=adminRDS&password=*****
table.whitelist=4427_Data
mode=timestamp
timestamp.column.name=TmStamp
validate.non.null=false
topic.prefix=mysql-
And that is saved at:
/etc/kafka-connect-jdbc/kafka-connect-jdbc-source.properties
I then run:
/usr/bin/confluent load jdbc_source_mysql_4427_Data -d /etc/kafka-connect-jdbc/kafka-connect-jdbc-source.properties
and get this error:
{
"error_code": 400,
"message": "Connector configuration is invalid and contains the following 2 error(s):\nInvalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://lndbtest.cdveaddpnevv.us-east-2.rds.amazonaws.com:3306/LNDBv1?user=adminRDS&password=*** for configuration Couldn't open connection to jdbc:mysql://lndbtest.cdveaddpnevv.us-east-2.rds.amazonaws.com:3306/LNDBv1?user=adminRDS&password=***\nInvalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://lndbtest.cdveaddpnevv.us-east-2.rds.amazonaws.com:3306/LNDBv1?user=adminRDS&password=*** for configuration Couldn't open connection to jdbc:mysql://lndbtest.cdveaddpnevv.us-east-2.rds.amazonaws.com:3306/LNDBv1?user=adminRDS&password=***\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
}
It seems to be a driver issue. My question at this point is, "Do I need to download the MySQL JDBC driver to my EC2 instance, or should that have been included in the Confluent Platform package?"
Also, does my overall idea sound like a good fit for Kafka Connect?
As I mentioned earlier, I am new to these technologies, but have found the best way to learn something is to jump right in and try to solve a problem. Any ideas and suggestions would be more than welcome. Thank you!
The overall concept makes sense to me. You do need to download the driver and add it to your worker classpath. It isn't packaged for licensing reasons I assume.
As #dawsaw says, you do need to make the MySQL JDBC driver available to the connector.
My observation here would be–given a free hand in all the application and architecture you describe– it would be best to stream from the sensor into Kafka, and then from there Kafka into MySQL, Mongo, webapp, etc.
Streaming into a DB to then stream out of the DB is not a perfect choice, if you have the option.
It's because there's no mysql driver in the distribution of confluent. I think you can solve the problem by downloading a mysql driver jar file, then putting it in confluent/share/java/kafka-connect-jdbc folder and re-run the program.
I have a problem inserting data to my mysql database table. I have an error :
Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find output table 'book'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:287)
at connectTest.ConnectTest.insertPerson(ConnectTest.java:55)
at connectTest.ConnectTestDemo.main(ConnectTestDemo.java:16)
Java Result: 1
I don't know why could not find my table.
I have created that in mysql database.
Please provide your source code and configuration file so that I can help you better.
Can you correctly connect to the database? You said you are using MYSQL database but I see you are using MS Access ODBC driver for the connection. If that is the case I recommend you use the MYSQL JDBC driver which you can download from
http://dev.mysql.com/downloads/connector/j/
If you can connect to the database correctly, then you may have not set your database schema (database name) properly.
Please provide your source code and configuration file so that I can help you better.
For an example of how you should configure db using pure JDBC have a look at this link:
http://www.tutorialspoint.com/jdbc/jdbc-insert-records.htm
Basically you provide a connection url in the format jdbc:mysql://[MySQLServer_DOMAIN_NAME_OR_IP_ADDRESS]:[PORT]/[DB_NAME].
I'm trying to host a cakephp2 application on an old managed server that has pdo_mysql disabled. Politics dictates that I'm unable to rectify this problem, so I'm looking for connection alternatives.
cakephp is producing the following error:
"A Database connection using "Mysql" was missing or unable to connect.
The database server returned this error: Selected driver is not enabled"
Is there a way to connect to the database using the older mysql database extension?
There's no easy way to do it.
If you want to, you could write your own DboSource class, you could reuse the the existing one and use the old-deprecated mysql database extension. (Or if you're lucky you could find one on the internet, but i doubt it)
Then you'll only need to change the DboSource in your settings to use your own class
Hope this helps