JMeter Couldnt Connect to Phoenix using JDBC Connection - java

I'm setting up a JMeter Connection to Phoenix using its JDBC Connection Configuration but it wont connect due to some jars and connection problem. I have tried configuring all of the compatible jars and configure the connection but it won't work either.
I've added Phoenix Jar to Classpath in Test Plan Setting.
The JDBC connection setting are as below:
Database Url: jdbc:phoenix://ip:port:/hbase-unsecure/schema_name
Driver Class: org.apache.phoenix.jdbc.PhoenixDriver
After configuring the phoenix database all i want to do is to do some simple query like SELECT * FROM table_name
Using MySQL Connection was successful and it shows me the data inside the database. However using this Phoenix Configuration, it won't even connect to the database and I am getting various error such as
Cannot create JDBC driver of class 'org.apache.phoenix.jdbc.PhoenixDriver' for connect URL
or
Couldn't established connection
or
java.lang.NoClassDefFoungError: Could not initialize class org.apache.phoenix.jdbc.PhoenixDriver

I got it resolved. turns out the driver for phoenix (phoenix-4.7.0.2.6.1.0-129-client) is suitable for JMeter version 2.9.
And in order the phoenix driver to work in JMeter, use phoenix-4.7.0.2.6.4.0-91-client, not phoenix-4.7.0.2.6.1.0-129-client.
and if you have service mapping enabled problem, extract your jar, find hbase-default file, and add another property for service mapping enabled = true.

Related

Problem in Oracle JDBC Connection Configuration/JDBC Request - JMETER

I'm a problem in JDBC Connection Configuration. When i execute my test (only JDBC Request - insert), doesn't appear any results in report (View Results Tree):
"Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:JDTST'"
The connection is Oracle. See below the configuration:
database URL: jdbc:oracle://${myURL}
JDBC driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Username: ${user}
Password: ${password}
Print below:
lister.ora file:
My login in Oracle DB:
Could someone help me?
Thanks!!!
I don't think your URL is correct, it should be something like:
jdbc:oracle:thin:#your-oracle-hostname-or-ip-address:your-oracle-port:your-oracle-SID
Correct JDBC Driver fully qualified name is oracle.jdbc.driver.OracleDriver
The "Validation query" should be select 1 from dual
You will need to download Oracle JDBC Driver and drop it to JMeter Classpath
More information:
OracleDriver Documentation
DBCP - validationQuery for different Databases
The Real Secret to Building a Database Test Plan With JMeter
Refer to JDBC Developer's guide on how the JDBC connection URL is formed.
The easiest way is to use the below URL. You can use DataSourceSample.java for checking the connection.
jdbc:oracle:thin:db_user/db_password#localhost:5221:orcl
Database SID is no longer supported; please use a service name as in Nirmala's response.

Error when trying to open a JDBC connection to Google Cloud Spanner

I am trying to open a JDBC connection to a Google Cloud Spanner database, but I get the following error message:
java.lang.IllegalArgumentException: A project ID is required for this
service but could not be determined from the builder or the
environment. Please set a project ID using the builder.
My JDBC URL is as follows:
jdbc:cloudspanner://localhost;Project=project-id;Instance=instance-id;Database=database-name;PvtKeyPath=path-to-key-file
If I remove the Project property from the URL, I get the following exception:
java.sql.SQLNonTransientConnectionException: [Simba]JDBC
Connection Refused: [Simba]JDBC Required Connection Key(s):
Project; [Simba]JDBC Optional Connection Key(s): Language,
Mode
So it seems that the driver does pick up my Project ID, but somehow does not accept it. I have checked and double checked that my project id does equal the project id that I created on Google, I have also tried to change the value to the project name instead of the project id, but to no avail.
Does anyone have a URL example that works?
EDIT: It appears to be related to the reference to the private key file. If I make an environment variable GOOGLE_APPLICATION_CREDENTIALS pointing to my private key file, the connection can successfully be made. If I remove this environment variable, I get the above exception.
Which version of the driver are you using? In the latest version, if you are specifying the path to the credentials file in the URL then you need not set GOOGLE_APPLICATION_CREDENTIALS.
As the JDBC Driver supplied by Google is severely limited (does not support DML and DDL statemetns), I have written my own JDBC Driver. The driver is designed to work with JPA/Hibernate-enabled applications. The driver can be found here: https://github.com/olavloite/spanner-jdbc
This driver supports the same kind of URL's as the driver supplied by Google, including the PvtKeyPath property.

GlassFish Server does not connect to SQL database (error w.r.t. SQL driver)

I am using a brand new developing pc and need to test a personal application that runs on a local GlassFish server 3.1.2 and should connect with a local SQL database called 'funkOneDB' (my IDE is NetBeans 7.2.1). But I can't get the GlassFish server to connect with the database, and the problem seems to be related to the (place of the) SQL driver in the GlassFish Server's directories (more problem specifics in a few lines).
I am fairly certain I correctly set up the related JDBC Resource and Connection Pool on the GlassFish Server (as I mimic a set-up already existing and working properly on another developing pc).
The Resource specifics are:
jndi name: jdbc/FunkResource
pool name: FunkPool
The (most important) Pool specifics are:
pool name: FunkPool
resource type: javax.sql.Datasource
datasource classname: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
additional properties correspond to the specifics in the XML GlassFish-resources of the application (username, password, url, etc.; no problems there)
I first placed the necessary SQL driver in the GlassFish Server's directories, i.e. the file mysql-connector-java-5.1.18-bin.jar at ..\GlassFish3\GlassFish\domains\domain1\lib\ext.
Yet, when I perform a ping test from the JDBC Pool 'FunkPool' at the GlassFish server, I get the following error:
Ping Connection Pool failed for FunkPool. WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.SQLError], because it has not yet been started, or was already stopped Please check the server.log for more details.
In the server.log I only find the following extra logging exception and failure info:
(i) Exception while creating an unpooled [test] connection for pool [ FunkPool ], WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.SQLError], because it has not yet been started, or was already stopped
(ii) RestResponse.getResponse() gives FAILURE. endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=FunkPool}'
Note however, that when I ping the database funkOneDB from my IDE NetBeans via jdbc:mysql://localhost:33066/funkOneDB, it's succesful. As already mentioned, the credentials and other data I use for this IDE-based ping are the same data I use in the JDBC Connection Pool.
I searched for the problem also on stackoverflow for some. And I did find some people talking about it, like
Glassfisch MySQL ping ERROR (no answer by anybody), or
Struggling to create MySQL Connection Pool on Glassfish (tried that solution, i.e. putting the SQL driver one level up in ..\GlassFish3\GlassFish\domains\domain1\lib\, but this creates other errors, even after restarting the Glassfish server), or
GlassFish not loading connector
(even tried this solution, no succes).
Can somebody help me solve this problem? Many thanks in advance!
With kind regards,
Heinz
Place the mysql driver in the lib folder of your project. Then do a clean-and-build. It's also helpful to have netbeans communicate directly with your database. This will allow you to view the database structure and the contents of your database right from your IDE. For help integrating MySQL with netbeans, look here: netbeans.org/kb/docs/ide/mysql.html
My friend, i had this same exception:
RestResponse.getResponse() gives FAILURE. endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=FunkPool}'
The cause of my error was that, i put wrong credentials. Check your credentials in your client DB App (SQL Developer, for example).
I had the same problem with SQL server and Netbeans. To resolve it, i put the sqljdbc.jar in the java direcory "Java\jdk1.8.0_121\lib directory" and it works :)
I've just spebnt 10 hours on this bug.

JDBC Connection URL For Embedded Derby in a Webapp

I have a derby database that is deployed along with my webapp to WEB-INF/classes/myDb
What should my jdbc.connection url be to connect so that I can write to the database?
I am trying
jdbc:derby:myDb;
and it can not find the database. I need to be able to modify the database. If i put classpath:myDb, it finds it, but it is unfortunately read only per the derby docs.
i solved it by setting my jdbc connection url at runtime and using:
StringBuilder derbyUrl = new StringBuilder("jdbc:derby:");
derbyUrl.append(servletContext.getRealPath("/"));
derbyUrl.append("/WEB-INF/classes/myDb;");
dataSource.setUrl(derbyUrl.toString());

sql server 2005:how to connect to sql server 2005 on platform jboss 3.0?

i have deployed my application on jboss 3.I have restored a database back up of sql server 2000 on sql server 2005.then i have downloaded the jr file jdbc connection to sql server 2005.My connection string setting is as below.
<datasources>
<local-tx-datasource>
<jndi-name>SLBDataSource</jndi-name>
<connection-url>jdbc:sqlserver:\\RAVIGARG\SQLSERVER2005;DatabaseName=Sahil_test_12_12_09;SelectMethod=cursor</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<user-name>sa</user-name>
<password>sa</password>
</local-tx-datasource>
But i am getting exception as below.
WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection:
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC] Unable to connect. Invalid URL.)
According to Building the Connection URL, the general form of a connection url is
jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
So, if RAVIGARG is ther server name, try something like this instead (note the forward slashes):
jdbc:sqlserver://RAVIGARG\SQLSERVER2005;databaseName=Sahil_test_12_12_09;SelectMethod=cursor
PS: According to the stracktrace, you are using a JDBC driver for SQL Server 2000. This is not the root cause of the problem but maybe you should consider upgrading it as you are using SQL Server 2005. If you do so, note that the driver class name is com.microsoft.sqlserver.jdbc.SQLServerDriver so update your <driver-class> accordingly. See SQL Server 2005 JDBC Driver Documentation.
Just a suggestion: you might want to use jTDS instead. It is much more stable than Microsoft's drivers, delivers great performance and works with all kinds of flavors of SQL Server. We've been using it on our production servers for years.
This would be the appropriate connect string:
jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
You can find out everything about driver names etc. in the jTDS FAQ.

Categories