I got the following error in the database manager DBeaver 22.1.4 on the informix database:
SQL-Error [IX000]: Connection not established
Strangely if i make a select only on this table i got the error above. But if i make a select on all other tables the select has an result.
The full error message you find here:
org.jkiss.dbeaver.model.impl.jdbc.JDBCException: SQL-Error [IX000]: Connection not established
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCConnectionImpl.prepareStatement(JDBCConnectionImpl.java:197)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCConnectionImpl.prepareStatement(JDBCConnectionImpl.java:1)
at org.jkiss.dbeaver.model.DBUtils.createStatement(DBUtils.java:1391)
at org.jkiss.dbeaver.model.DBUtils.makeStatement(DBUtils.java:1359)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:553)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$1(SQLQueryJob.java:486)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:172)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:493)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:894)
at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3643)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:118)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:172)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:116)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4945)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLException: Connection not established
at com.informix.util.IfxErrMsg.buildExceptionWithMessage(IfxErrMsg.java:416)
at com.informix.util.IfxErrMsg.buildException(IfxErrMsg.java:397)
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:371)
at com.informix.jdbc.IfxStatement.<init>(IfxStatement.java:134)
at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:116)
at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:5902)
at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:2367)
at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:101)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCConnectionImpl.prepareStatement(JDBCConnectionImpl.java:244)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCConnectionImpl.prepareStatement(JDBCConnectionImpl.java:146)
... 15 more
Have somebody an idea?
Related
I'm facing a problem with my PolyBase. I'm using my SQL Server to access data in MongoDB Atlas Database. However. when I try to create my external table I have the following error:
105082;Generic ODBC error: [Microsoft][MongoDBODBC] (110) Error from
MongoDB Client: No servers yet eligible for rescan (Error Code: 13053)
Additional error <2>: ErrorMsg: [Microsoft][MongoDBODBC] (110) Error
from MongoDB Client: No servers yet eligible for rescan (Error Code:
13053), SqlState: HY000, NativeError: 110 .
At the moment, my script is :
CREATE EXTERNAL DATA SOURCE mongodb_test
WITH (
LOCATION = 'mongodb://cls-data-dev-biconnector.a8m8q.mongodb.net:27015',
CONNECTION_OPTIONS = 'tls=false',
CREDENTIAL = mongodb_test
)
CREATE EXTERNAL TABLE base360 (
[_id] VARCHAR(24) NOT NULL,
[ds_Contexto] varchar(max) NULL
)
WITH (
LOCATION='[db-data].[db-mng-ins-corporate-dev]',
DATA_SOURCE= mongodb_test
);
What should I do? I didn't find a solution to solve this problem.
Can someone help me, please?
Thank you
Getting Below Error
OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) (SQLDriverConnect); [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). (53)'
*** Settings ***
Documentation Simple example using DBLibrary.
Library SeleniumLibrary
Library DatabaseLibrary
*** Variables ***
${DBHost_ConnectionString} 'DRIVER={SQL Server};SERVER="hostname";UID="uname";PWD="******";DATABASE="dbname"'
*** Test Cases ***
Connect Database
Connect To Database Using Custom Params pyodbc ${DBHost_ConnectionString}
I tried all the solutions over internet, like adding port to connection string, appending tcp before servername, e.t.c,
Followed the implementation mentioned in the source code of dbapi
https://github.com/franz-see/Robotframework-Database-Library/blob/master/src/DatabaseLibrary/connection_manager.py
elif dbapiModuleName in ["pyodbc", "pypyodbc"]:
dbPort = dbPort or 1433
logger.info('Connecting using : %s.connect(DRIVER={SQL Server};SERVER=%s,%s;DATABASE=%s;UID=%s;PWD=%s)' % (dbapiModuleName, dbHost, dbPort, dbName, dbUsername, dbPassword))
self._dbconnection = db_api_2.connect('DRIVER={SQL Server};SERVER=%s,%s;DATABASE=%s;UID=%s;PWD=%s' % (dbHost, dbPort, dbName, dbUsername, dbPassword))
Any help should be appreciated.
As a guess, you shouldn't surround your connection string with single quotes, as they become part of the connection string. Robot is not python, and robot is not the shell, so you don't normally need to quote strings.
*** Variables ***
${DBHost_ConnectionString} DRIVER={SQL Server};SERVER="hostname";UID="uname";PWD="******";DATABASE="dbname"
It's not clear if you're literally using the string hostname and uname, etc., or if that's just boilerplate for the purpose of the question. You need to be passing the actual hostname and actual username and password.
You may not need the quotes around the other values, in which case it would look like this:
*** Variables ***
${DBHost_ConnectionString} DRIVER={SQL Server};SERVER=hostname;UID=uname;PWD=******;DATABASE=dbname
I'm trying to import some data from different SqlServer databases using ExecuteSQL in NiFi, but it's returning me an error. I've already imported a lot of other tables from MySQL databases without any problem and I'm trying to use the same workflow structure for the SqlServer dbs.
The structure is as follows:
There's a file .txt with the list of tables to be imported
This file is fetched, splitted and uptaded; so there's a FlowFile for each table of each db that has to be imported,
These FlowFiles are passed into ExecuteSQL which executes their contents
For example:
file.txt
table1
table2
table3
is being updated into 3 different FlowFiles:
FlowFile1
SELECT * FROM table1
FlowFile2
SELECT * FROM table2
FlowFile3
SELECT * FROM table3
which are passed to ExecuteSQL.
Here follows the configuration of ExecuteSQL (identical for SqlServer tables and MySQL ones)
ExecuteSQL
As the only difference with the import from MySQL db is in the connectors, this is how a generic MySQL connector has been configured:
SETTINGSPROPERTIES
Database Connection URL jdbc:mysql://00.00.00.00/DataBase?zeroDateTimeBehavior=convertToNull&autoReconnect=true
Database Driver Class Name com.mysql.jdbc.Driver
Database Driver Location(s) file:///path/mysql-connector-java-5.1.47-bin.jar
Database User user
PasswordSensitive value set
Max Wait Time 500 millis
Max Total Connections 8
Validation query No value set
And this is how a SqlServer connector has been configured:
SETTINGSPROPERTIES
Database Connection URL jdbc:jtds:sqlserver://00.00.00.00/DataBase;useNTLMv2=true;integratedSecurity=true;
Database Driver Class Name net.sourceforge.jtds.jdbc.Driver
Database Driver Location(s) /path/connectors/jtds-1.3.1.jar
Database User user
PasswordSensitive value set
Max Wait Time -1
Max Total Connections 8
Validation query No value set
It has to be noticed that one (only one!) SqlServer connector works and the ExecuteSQL processor imports the data without any problem. The even stranger thing is that the database that is being connected via this connector is located in the same place as other two (the connection URL and user/psw are identical), but only the first one is working.
Notice that I've tried appending ?zeroDateTimeBehavior=convertToNull&autoReconnect=true also to the SqlServer connections, supposing it was a problem of date type, but it didn't give any positive change.
Here is the error that is being returned:
12:02:46 CEST ERROR f1553b83-a173-1c0f-93cb-1c32f0f46d1d
00.00.00.00:0000 ExecuteSQL[id=****] ExecuteSQL[id=****] failed to process session due to null; Processor Administratively Yielded for 1 sec: java.lang.AbstractMethodError
Error retrieved from logs:
ERROR [Timer-Driven Process Thread-49] o.a.nifi.processors.standard.ExecuteSQL ExecuteSQL[id=****] ExecuteSQL[id=****] failed to process session due to java.lang.AbstractMethodError; Processor Administratively Yielded for 1 sec: java.lang.AbstractMethodError
java.lang.AbstractMethodError: null
at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:874)
at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:270)
at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:389)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2398)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:305)
at org.apache.nifi.dbcp.DBCPService.getConnection(DBCPService.java:49)
at sun.reflect.GeneratedMethodAccessor1696.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:84)
at com.sun.proxy.$Proxy449.getConnection(Unknown Source)
at org.apache.nifi.processors.standard.AbstractExecuteSQL.onTrigger(AbstractExecuteSQL.java:195)
at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1165)
at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203)
at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
These are commands which I am running:-
bin/zookeeper-server-start etc/kafka/zookeeper.properties &
bin/kafka-server-start etc/kafka/server.properties &
bin/schema-registry-start etc/schema-registry/schema-registry.properties &
bin/connect-standalone etc/schema-registry/connect-avro-standalone.properties etc/kafka-connect-jdbc/quickstart-sqlserver.properties &
bin/kafka-avro-console-consumer --new-consumer --bootstrap-server localhost:9094 --topic test3-sqlserver-jdbc-ErrorLog --from-beginning
I am trying to connect sqlserver using confluent platform(kafka-connect) and facing following issues:
When I am trying to connect to default schema i.e. dbo , connection is built but it is not able to fetch data into the kafka consumer. The connection details that I am using are:
name=test-sqlserver-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:sqlserver://********:1433;database=AdventureWorks2012;user=****;password=****
mode=incrementing
incrementing.column.name=ErrorLogID
topic.prefix=test3-sqlserver-jdbc-
table.whitelist=ErrorLog
schema.registry=dbo
When I am trying to connect to any other schema, the producer is throwing error, connection details that i am using are :
name=test-sqlserver-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:sqlserver://********:1433;database=AdventureWorks2012;user=****;password=****
mode=incrementing
incrementing.column.name=AddressID
topic.prefix=test3-sqlserver-jdbc-
table.whitelist=Address
schema.registry=Person
Error :
INFO Source task WorkerSourceTask{id=test-sqlserver-jdbc-autoincrement-0} finished
initialization and start (org.apache.kafka.connect.runtime.WorkerSourceTask:138)
[2017-03-07 17:55:47,041] ERROR Failed to run query for table
TimestampIncrementingTableQuerier{name='Address', query='null',
topicPrefix='test3-sqlserver-jdbc-', timestampColumn='null',
incrementingColumn='AddressID'}:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'Address'.
io.confluent.connect.jdbc.JdbcSourceTask:239)
[2017-03-07 17:55:52,124] ERROR Failed to run query for table
TimestampIncrementingTableQuerier{name='Address', query='null',
topicPrefix='test3-sqlserver-jdbc-', timestampColumn='null',
incrementingColumn='AddressID'}: com.microsoft.sqlserver.jdbc.SQLServerException:
Invalid object name 'Address'. (io.confluent.connect.jdbc.JdbcSourceTask:239)
[2017-03-07 17:55:53,684] INFO Reflections took 9299 ms to scan
262 urls, producing 12112 keys and 79402 values
(org.reflections.Reflections:229)
[2017-03-07 17:55:57,181] ERROR Failed to run query for table
TimestampIncrementingTableQuerier{name='Address', query='null',
topicPrefix='test3-sqlserver-jdbc-', timestampColumn='null',
incrementingColumn='AddressID'}:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'Address'.
(io.confluent.connect.jdbc.JdbcSourceTask:239)
Brief introduction of the problem:
the main problem is not in the connection procedure, i could connect to database successfully, and insert some rows in my database(firs code block shows this),but after closing the connection if someone tries to insert a row in the database ,matlab will terminate suddenly without any clear error message, (i expect to have a function to check if the connection is open or close or to get an error message to handle the error but non of these happened and just matlab closed because of a fatal error)
i wrote the following code to connect to MS SQL SERVER database in matlab:
conn=database.ODBCConnection('MS SQL SERVER','','');
insert(conn,'trace',{'obj_id','obj_type_id','time_step','pos_x','pos_y','vel_x','vel_y'},[1,1,1,0,0,0,0]);
close(conn);
and every thing was ok.
then i tried to insert another row (to check what is the error message) then Matlab closed (due to fatal error) without showing any error message.
i tried to use following functions to get status of database connection before inserting new raws:
isconnection(conn);
ping(conn);
but it says
Undefined function 'ping' for input arguments of type
'database.ODBCConnection'.
Undefined function 'isconnection' for input arguments of type
'database.ODBCConnection'
even i tried to use try-catch block but it didn't work and Matlab Closed for fatal error.
so i want to know is there any way to chek status of native ODBC to prevent sudden close of matlab in case of a closed connection??
Update:
>> conn=database.ODBCConnection('MS SQL SERVER','','')
conn =
ODBCConnection with properties:
Instance: 'MS SQL SERVER'
UserName: ''
Message: []
Handle: [1x1 database.internal.ODBCConnectHandle]
TimeOut: 0
AutoCommit: 0
Type: 'ODBCConnection Object'
>> close(conn)
>> conn
conn =
ODBCConnection with properties:
Instance: 'MS SQL SERVER'
UserName: ''
Message: []
Handle: [1x1 database.internal.ODBCConnectHandle]
TimeOut: 0
AutoCommit: 0
Type: 'ODBCConnection Object'
no properties or message changed before and after closing the connection,
the problem is that i don't know how to check that if a connection is still open or closed in other parts of a program!
in this case if i use an insert command when a connection was closed before,
matlab suddenly terminates (and show the message MATLAB(R2013B) has stopped working),
so i want to know is there any way to check if a native odbc connection has closed before?
Further update
>> conn=database('MS SQL SERVER','','')
conn =
Instance: 'MS SQL SERVER'
UserName: ''
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 sun.jdbc.odbc.JdbcOdbcConnection]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'
>> isconnection(conn)
ans =
1
>> close(conn)
>> isconnection(conn)
ans =
0
i mean a function like "isconnection" in the example above for jdbc connection which returns 1 if a connection is open and 0 if the connection closed before.
I request you to check the database connection with toolstrip functionality of Matlab. You can find complete guide from here...
You can perform the testing first so that you can ruled out of any problem with server..
Once it is connected successfully..you can check the code.connection settings and apply it in your code accordingly.
Regards,
As per the documentation you can check status of an existing database.ODBCConnection or database.ODBCCursor in the Database Toolbox by checking the value of the Message property in the database.ODBCConnection object and the database.ODBCCursor Object.
You may need to set Error handling to store using setdbprefs('ErrorHandling','store'). Use setdbprefs('ErrorHandling','report') to switch it back again.
ping and isconnection only work on database connection object and not on database.ODBCConnection objects.