Nifi-1.0.0 and Crate.IO - java

Crate database offers a jdbc driver through which I should be able to connect to Crate from Nifi using DBCPConnectionPool controller service. So I did that, I get a connection, the ConvertJSONToSQL processor is able to get the columns from the Crate database but when I get to the PUTSql processor I get the following error:
FlowFileHandlingException: transfer relationship not specified
The thing is that I have a SUCCESS, FAILURE, RETRY relationship defined. It just throws a ProcessException in the onTrigger() method.
Any ideas how can I make it work ?
As soon as the jdbc driver is compatible it should work, but ...

I believe this is a bug in PutSQL that is hiding an issue either in the JDBC configuration, SQL statement, or something else. Using the standalone JDBC driver with valid SQL INSERT statements, I was able to PutSQL working with Crate.
Can you double-check your connection information and SQL statement(s)? Also if you can reproduce and want to share the SQL and/or connection info (JDBC URL, e.g.), please feel free, it could help get to the bottom of the PutSQL bug that is hiding another issue.

Related

Where exactly should JDBC URL value be changed?

I'm trying to run some application and get the following error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Can't start a cloned connection while in manual transaction mode.
I know that I should add the parameter ;SelectMethod=Cursor to your JDBC URL
But I'm having problem understanding where exactly should I change it? Should it be some conf file in JDBC driver folder somewhere? Or can I do it from sql management studio?
Also is there some easy way to determine if and what version of JDBC driver I have?
Help is very much appreciated!
You specify the URL when creating your JDBC connection, e.g.:
Connection con = DriverManager.getConnection(
"jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]",
username,
password);
Of course you have to replace the stuff in the brackets with your values.
Quite the same is true for every other tool (e.g. IntelliJ, Eclipse) I know of that connects to a DB via JDBC. See e.g. attached screenshot. Here you also specify the connection parameters via the JDBC URL.

Exception while connecting to DB2 in java using JDBC

I am trying to connect to a db2 database in Java. Below the driver and the connection string and the driver details i am giving
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
String url="jdbc:db2://hostname:portnumber/databasename";
sourceConnection=DriverManager.getConnection(url,"username","password");
But I am getting the below exception
"COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0615E Error receiving from socket, server is not responding. SQLSTATE=08S01"
I also tried changing the connection string to
String url="jdbc:db2:hostname:portnumber/databasename";
Still it is resulting the same exception above while trying to get the Connection.
And i have tried the below option also using JDBC app driver
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
DB2DataSource db2ds = new DB2DataSource();
db2ds.setServerName("hostname");
db2ds.setPortNumber(portnumber);
db2ds.setDatabaseName("databasename");
db2ds.setUser("username");
db2ds.setPassword("password");
sourceConnection=db2ds.getConnection();
For the above two connection I used the jar "db2java.jar"
And i have tried using the JCC driver:
Class.forName("com.ibm.db2.jcc.DB2Driver");
String url="jdbc:db2://hostname:portnumber/databasename";
sourceConnection=DriverManager.getConnection(url,"username","password");
For this connection i have added the below jars
1)db2jcc.jar
2)db2jcc_license_cu.jar
This time around I am getting the below error,
"com.ibm.db2.jcc.am.go: [jcc][t4][201][11237][3.57.82] Connection authorization failure occurred.
Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000"
I tried to connect to the same db2 source using "Quest for DB2" tool and the connection was successful.
Am i missing something in the code and is it a problem with DB2 drivers or connection string?
Can someone please guide me.
Thanks in advance.
Cause:
If the DB2® instance where InfoSphere Optim Performance Manager is running has the authentication configuration parameter set to DATA_ENCRYPT, you cannot log in to the web console.
Resolving the problem:
Do the following steps:
On the DB2 instance where Optim Performance Manager is running, set the authentication configuration parameter to SERVER by issuing the following command:
db2 update dbm cfg using authentication server
Restart the DB2 instance and InfoSphere Optim Performance Manager.
For more details visit here.
Your first two attempts were not supposed to work. You're using the JCC driver URL format, so it wouldn't be valid for either "net" or "app" drivers, which are deprecated anyway.
Use the JCC driver (com.ibm.db2.jcc.DB2Driver) and the URL format of "jdbc:db2://hostname:portnumber/databasename" and see this technote for the solution to the "Security mechanism not supported" problem. In short, you need to use a supported JDK.

Play! framework - Cannot connect to database

this is the error I get when I'm trying to connect to my local postgresql db:
Cannot connect to database [default]
this is the database configuration. I'm convinced that there is not typo (fat finger error):
db.default.url="postgres://localhost:5432/myproject/"
db.default.user="postgres"
db.default.pass="mypassword"
db.default.driver="org.postgresql.Driver"
db.default.initSQL="SELECT 1"
where is the problem? with pgAdmin I can connect easily
p.s.
I'm using ubuntu. I've noticed that in order to change to postgres user
I must use "su", otherwise it fails changing the current user.
is that has something to do with play! failure to connect my db?
thanks
There might be two things wrong or at least dubious in your setup.
First: The postgres:... URL syntax is not a plain JDBC URL. This format is not understood by the PostgreSQL JDBC driver. See this answer to a similar problem.
Second: You are trying to use the PostgreSQL superuser account for Play. The superuser account should be used only for administrative work, but not "normal" work. Especially not for work which includes public access to the DB via some webfrontend. Any SQL-Injection attack gives the attacker the golden key to your database - including the nuke to wreck your complete DB cluster at once or install any backdoor into you DB server.
So I recommand, that you create a new user which you configure in your Play! settings.
That said: The default password for the postgres user is not set on Ubuntu. This setup allows login to the DB user only from the same OS user. How you can fix this is explained in this answer.
If these two tips don't help: The error you quoted is very vague. There must be more detailed error logs somewhere. Please find them and attach them to your question with the "edit" button.
This is not an answer directly to your question, but I had the same error message and came here via Google. Using Scala Play 2.3, I had
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://127.0.0.1:5432/noob_development"
db.default.logStatements=true
which needed to be
db.default.driver="org.postgresql.Driver"
db.default.url="jdbc:postgresql://127.0.0.1:5432/noob_development"
db.default.logStatements=true
I accidentally left the quotes around the driver name out. Now it works perfectly.
here is my conf, it works:
db.default.url="jdbc:postgresql://127.0.0.1:5432/dbname"
db.default.driver="org.postgresql.Driver"
just add the jdbc: before postgresql in db.default.url.

How to get all the tables which I created using hsqldb runserver in standlone mode

I created the jdbc connection successfully for hsqldb in stanlone mode.I found where the new database is created.Using the path of newly created database in runserver ,I created some tables.But when I tried to get those table using jdbc connection,I could not get those table.
connection url is:"jdbc:hsqldb:file:databasename;ifexist=true","SA",""
for getting tables I m using the following query.
"select table_name from information_schema.system_tables where table_type='table'";
I am using hsqldb 2.2.7.
You seem to be trying to access the database simultaneously via Server and in-process. This is not possible. After each type of access, you need to shutdown the database before you connect to it via the alternative type of access. Therefore shutdown the Server once you have created the tables, then connect to the database in-process.
It is easier to access the database via Server only, and avoid such problems. Please also upgrade to version 2.2.8 to avoid a bug which may affect a database that has not been shutdown properly.

setting Client Info in JDBC for Oracle

I have a Java application which needs to be audited (so obviously I need a way in which the app can be identified with the application name). I googled and found that ojdbc14 has the method .setClientInfo which allows registering the application with a customized name, so I am trying to get it work but I get the following error:
Exception in thread "main" java.lang.AbstractMethodError:
oracle.jdbc.driver.T4CConnection.setClientInfo(Ljava/lang/String;Ljava/lang/String;)V
I am using ojdbc14 with oracle 10g express. If I do not set the line:
connection.setClientInfo("ApplicationName","Customers");
it works pretty well ....and by checking the audit info I can see that oracle gets the application name:OS_program_name=JDBC Thin Client, but I need a way to change it for a customized name.
By uncommenting that line which is supposed to set the application name it returns the error above.
Per oracle documentation that method is available for a Connection object. Do you have any idea how to solve this issue?
For AbstractMethodError, please check Why do I get java.lang.AbstractMethodError when trying to load a blob in the db?
In order to distinguish your connections in Oracle you can use this sample code below:
Properties jdbcProperties = new Properties();
this.jdbcProperties.put("user", userName);
this.jdbcProperties.put("password", password);
this.jdbcProperties.put("v$session.program", "YourApplicationName");
DriverManager.getConnection(url, jdbcProperties);
then check v$session by grouping against program column for your connections..

Categories

Resources