Callable statement in jdbc - jdbc

hi i wrote a jdbc program using callable statement and i installed the connector j also .I have created a stored procedure also in mysql .I installed the following driver also
C:\Program Files\MySQL\mysql-connector-java-5.1.21 (3)\mysql-connector-java-5.1.21
but i am still getting an error
java.sql.SQLException: No suitable driver found for jdbc:mysql:localhost
java.lang.NullPointerException

if you are doing this through eclipse then you have to put the mysql required jar file to the lib folder of the project structure or else using build path of the eclipse. If you are doing this local system then you have to set path(Environmental variable).

Related

SQL Server Driver Error Failed to find or load the JDBC driver:

I am getting below error while trying to connect to SQL SERVER. I have already done following and still getting the error:
downloaded Sqljdbc42.jar file
placed it in "C:\tibco\tpcl\5.9\jdbc" folder
updated designer.tra file - appended tibco.env.CUSTOM_CP_EXT and tibco.env.STD_CP_EXT with "C:\tibco\tpcl\5.9\lib\sqljdbc42.jar"
I also did tried placing the jar file in "C:\tibco\tpcl\5.9\lib" and
"C:\tibco\bw\5.12\lib" folder and repeated Step3 above, however, no luck..
any suggestions ?
Error:
BW-JDBC-100033 "Configuration Test Failed. Failed to find or load the
JDBC driver: tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver"
tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver driver comes with tibco BW installation. looks like the tibco tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver driver was not installed in your environment.
If you want to use sqljdbc42.jar you need to specify correct jdbc driver class in Tibco connection configuration in "JDBC Driver" field (please see screenshot).
For sqljdbc42.jar the "JDBC Driver" is
com.microsoft.sqlserver.jdbc.SQLServerDriver
you can find The JDBC driver class name and connection string example in https://learn.microsoft.com/en-us/sql/connect/jdbc/using-the-jdbc-driver?view=sql-server-2017
the connection string should look like:
jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;user=MyUserName;password=*****;
as you said you need to add sqljdbc42.jar to C:\tibco\tpcl\5.x\jdbc folder.
The folder C:\tibco\bw\5.x\lib also works.
You need to restart designer after adding jars.

java.lang.ArrayIndexOutOfBoundsException: 7

While getting JDBC connection I am getting above error.
I tried with ojdbc14 and ojdbc6 jar but same error.
my java version is 1.6 and oracle 11.2 and glassfish3
Note: I have created one sample java program to connect to DB using same DB details.Its working fine but with appication its giving me this error.
below is the line of code giving error
con = DriverManager.getConnection(
"jdbc:oracle:thin:#192.168.1.255:1521:orcl","system","rakesh");
The fact that you see this "oracle.jdbc.ttc7.TTC7Protocol" indicates that a very old driver is being used. You must have a classes12.zip hanging around in your app and added to your classpath. If you remove it and replace it with the 11.2.0.3 or 11.2.0.4 ojdbc6.jar then this error should go away.

Can't Connect to MySQL Using apoc.jdbc and Neo4J Community Edition 3.0.4

I'm using Neo4J Community Edition 3.0.4 for the Mac. Within the plugins folder I've got apoc and the mysql connector for Java.
I would like to connect to MySQL on localhost using JDBC.
I've created an alias in the .neo4j.conf file using.
apoc.jdbc.mysql_basemodel.url=jdbc:mysql://localhost:3306/basemodel?user=fred&password=pw
In the browser I've tried to test the connection using:
CALL apoc.load.jdbc("mysql_basemodel","t_object") YIELD row
RETURN count(*);
but get the error
Failed to invoke procedure apoc.load.jdbc: Caused by: > java.lang.RuntimeException: No apoc.jdbc.mysql_basemodel.url jdbc url specified
It's almost as if Neo4J is not reading the .neo4j.conf file with the alias defined.
If, however, I skip the alias and put the full connection string is I get the error:
Failed to invoke procedure apoc.load.jdbc: Caused by: java.lang.RuntimeException: Cannot execute SQL statement SELECT * FROM t_object.
Error:
No suitable driver found for jdbc:mysql://localhost:3306/basemodel?user=...
which seems to suggest that the mysql JDBC driver isn't found.
What am I doing wrong?
You first need to register the JDBC driver for MySQL:
CALL apoc.load.driver("com.mysql.jdbc.Driver");
Once you've registered the MySQL JDBC driver your statements using apoc.load.jdbc will make use of this this driver when connecting to MySQL.
More information available in the docs here.
Download the mysql JDBC driver (e.g. from http://mvnrepository.com/artifact/mysql/mysql-connector-java) and drop it into the /plugins folder - same location like apoc's jar file.

How to create a MSSQL server connection in SOAPUI

I am new to SOAPUI. On internet i found, this can be done with two ways: Either i can use SoapUI JDBC wizard or Using groovy script.
First i tried to create connection using Wizard but i am getting this error :
com.eviware.soapui.support.SoapUIException: Failed to init connection
for driver [com.microsoft.jdbc.sqlserver.SQLServerDriver],
connectionString
[jdbc:microsoft:sqlserver://192.168.185.100\MyDB;databaseName=ABC?user=Test&password=Pass]
I extract the JDBC driver to path
C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server
and Copy this Jar file
C:\Program Files\Microsoft JDBC Driver 4.0 for SQL
Server\sqljdbc_4.0\enu\sqljdbc4.jar
to this folder
C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext\sqljdbc4.jar
Added Environment Variable
variable name : classpath
variable value : C:\Program Files\Microsoft JDBC Driver 4.0 for SQL
Server\sqljdbc_4.0\enu\sqljdbc4.jar;
Add sqljdbc_auth.dll(use x64 or x32 based on your system configuration), to *C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext* (the same path where you have placed the sqljdbc4.jar file).
That seems to be the only step missing in the setup you have described. Once that is in place the JDBC test step request should work fine.
You can follow this thread on the SmartBear community for this particular issue.
https://community.smartbear.com/t5/SoapUI-Open-Source/Solved-JDBC-Cannot-connect-to-a-MS-SQL-database/td-p/132235

How to fix "Unable to instantiate JDBC driver" Flyway command line error?

I'm new to Flyway. I'm using Flyway 3.2.1 on windows 64bit and just tried the command line tool with my local Oracle database installation (11g). I'm getting the following error:
ERROR: Unable to instantiate JDBC driver: oracle.jdbc.OracleDriver
What did I do wrong? In flyway.conf I configured my jdbc url and also username and password.
Thanks in advance
Matze
Problem solved. For Oracle you have to put the jdbc driver jar in the drivers sub directory.
This is documented here.
In summary: Go to http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html and choose the required Oracle JDBC driver version. Then download the "ojdbc6.jar" file and move it into the drivers folder beneath where Flyway is installed. The next time you run Flyway this should be picked up automatically.

Resources