I have installed Firebird 2.1 on windows Xp and using firebirdsql.jdbc-2.1.6 driver to connect with java. Code:
Class.forName("org.firebirdsql.jdbc.FBDriver");
connection = DriverManager.getConnection(
"jdbc:firebirdsql://localhost/3050//C:/firebird/database/EMPLOYEE.FDB",
"test","test");
I am getting following error:
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544375.
unavailable database
Reason: unavailable database at
org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:122) at
org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:140) at
java.sql.DriverManager.getConnection(DriverManager.java:525) at
java.sql.DriverManager.getConnection(DriverManager.java:171)
Please help.
Problem solved:
Actually I had problem with jar file that I got from
http://mirrors.ibiblio.org/pub/mirrors/maven2
I downloaded jaybird-full-2.1.6.jar from firebird offical website and problem got solved.
Correct URL is
"jdbc:firebirdsql://localhost:3050/C:\\firebird\\database\\EMPLOYEE.FDB"
I tried this URL earlier also but it was not working beacuse of jar issue.
As #Thorbjørn Ravn Andersen observes, your Jaybird JDBC URL is incorrect. The syntax is jdbc:firebirdsql:[host[/port]:]<database>. You need a colon between the host/port and the database path. Perhaps something like this:
"jdbc:firebirdsql://localhost/3050:C:\\firebird\database\EMPLOYEE.FDB"
Oops, I left in the leading slashes; try this:
"jdbc:firebirdsql:localhost/3050:C:\\firebird\database\EMPLOYEE.FDB"
Addendum: You might run through the common errors list. Also, my firebird database files end in .fdb, but the FAQ mentions .gdb. It can't hurt to check.
From https://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html#pure-java-default
Default URL format:
"jdbc:firebirdsql://host[:port]/<database>"
Deprecated, but still supported legacy URL format:
"jdbc:firebirdsql:host[/port]:<database>"
Then, the correct URL should be:
"jdbc:firebirdsql://localhost:3050/C:/firebird/database/EMPLOYEE.FDB"
Your URL is most likely broken for this driver.
Attach actual source to the jar and set a breakpoint in FBDataSource.getConnection(...) and see what values are actually present when the connection is attempted made.
Are you absolutely certain that the combination of a hostname with port agrees with a path to the FDB-file?
Looking at the documentation on this site:
http://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html, item 3.1
It seems that after the [port], you must have an slash "/" or double slash "//" in case you would connect on a linux server.
To connect to the database located on remote machine or cloud (linux) then use following link.
jdbc:firebirdsql:34.212.208.251/3050:/opt/app/db/sample_training.fdb
You should try this one. It works for me on Windows.
jdbc:firebirdsql://localhost:3050/C:\firebird\database\EMPLOYEE.FDB
Also make sure you added an exception for port 3050 to the Firewall.
Connection string example for Apache Tomcat properties.xml with specified IP, port, data base alias and encoding:
<entry key="db.url">jdbc:firebirdsql:127.0.0.1/2222:my-db-alias?lc_ctype=WIN1251</entry>
Related
I recently switched over from using a PC to a Mac and now for whatever reason one of my Impala drivers that worked fine is no longer found when run in Python. I keep receiving this error every time I run the script : "java.lang.RuntimeException: Class com.cloudera.impala.jdbc41.Driver not found". Please see code snippet for my connection below.
c = jaydebeapi.connect
(jclassname='com.cloudera.impala.jdbc41.Driver',
url='jdbc:impala://cloudera-impala-proxy.live.bi.xxx/;AuthMech=3;ssl=1;',
driver_args=['xxx', self.dwh_password], jars='/Users/xxx/Desktop/ImpalaJDBC41 2.jar')
Any help or suggestions are appreciated, I feel like I'm going crazy trying to get this to work.
Did you check do you have the ImpalaJDBC***.jar in your new machine.
Please check properly weather it's available at classpath/build path or not.
Edit:
You can use hive jdbc jar as well to connect with impala , just use the port of impala rather hive in jdbc url.
Looking at this error means your jar is corrupt.
First check your impalaJDBC jar
java -jar ImpalaJDBC<version>.jar
If it gives you error that means your jar is corrupt.
Download the correct jar from cloudera
I'm trying to connect to hive with jdbc. I keep getting this error. I tried looking it up but could not hind anything useful .
This is my connection string:
jdbc:hive2://hostname.xxx.com:10000/default;principal=hive/hostname.xxx.com#HADOOP_ENV.COM
What is this error: java.lang.NoSuchMethodError: org.apache.hadoop.security.authentication.util.KerberosUtil.hasKerberosTicket(Ljavax/security/auth/Subject;)Z
That method exists in Hadoop 2.8 but not in Hadoop 2.7 -- so my guess is that your project dependencies are not aligned with whatever version of Hadoop you have in Production.
Code in trunk
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosUtil.java
code in branch-2.8.0
https://github.com/apache/hadoop/blob/branch-2.8.0/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosUtil.java
code in branch-2.7.4
https://github.com/apache/hadoop/blob/branch-2.7.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosUtil.java
Kerberos is an authentication protocol that is used by Hive server (https://en.wikipedia.org/wiki/Kerberos_(protocol))
The problem you are setting is more about a missing library in our pom.xml. Have you include <artifactId>hive-jdbc</artifactId> ?
I think your keberos ticket is not generated properly
Can you try running these two commands in order from the user you are trying to connect:
kdestroy (deleted any kerberos ticket generated before)
kinit (generates a new ticket)
Then try to connect again.
I recently upgraded my jdk from 6 to 8 when I installed Eclispe for Android. Now, in NetBeans when I try to right click on the node for the database and select connect, I get the following error:
"Unable to connect. Cannot establish a connection to jdbc:derby://localhost 1527:/Animal using org.apache.derby.jdbc.ClientDriver (Unable to find a suitable driver)."
So far, I have tried uninstalling Eclipse and reinstalling Netbeans and that didn't work. I'm not getting any errors in my code aside from a popup that says the project is missing resources. Could someone please provide instructions on how to solve this issue? I've looked on the NetBeans' website and on this forum and there doesn't seem to be a clear procedure for resolving this.
If that's not a typo on your part your JDBC URL is malformed:
jdbc:derby://localhost 1527:/Animal
That's what I copied from your question. However, the correct URL would look like
jdbc:derby://localhost:1527/Animal
With the colon before the port, not after.
At Netbeans already states that this driver was tried but failed I'm quite sure it's got nothing to do with your driver setup. But if you want todouble check:
Here's a tutorial on how to add and enable oracle thin driver. I'd think it will work the same way for derby drivers.
I solved it in the following way:
The driver that you use to connect to the database may have deleted it or changed your address. So that:
You must put it back in the address that was indicated in the databases driver>
Drivers> (driver you use to connect)
Indicate the new address where you are
The error is in the path you are specifying in the driver or in the connection.
I had the same problem when trying to connect MySQL server to NetbeansIDE. Turns out the jdbc connector was an old version. You can read about the MySQL connector versions here. Either
download the latest version of MySQL connector or
add a new driver.
My problem was solved by adding a new driver.
I've been asked to connect an Apache Derby database to our existing MATLAB data-mining tools. I am running MATLAB R2014a (no Database toolbox)
After some research and trial and error, here's what I did:
went to http://www.java2s.com/Code/Jar/d/Downloadderbyclientjar.htm and downloaded derbyclient.jar and saved it, and unzipped it to a shared folder.
edited the text file C:\Users\tyler.davis\AppData\Roaming\MathWorks\MATLAB\R2014a\javaclasspath.txt and added full path to derbyclient.jar, saved it, restarted MATLAB.
At MATLAB command line
javaclasspath
shows "S:\SHARED...\derbyclientjar\derbyclient.jar\derbyclient.jar" at the end of the static path list. So far so good.
Next, try
driverClassName = 'org.apache.derby.jdbc.ClientDriver';
java.lang.Class.forName(driverClassName);
reports error:
Java exception occurred:
java.lang.ClassNotFoundException: org/apache/derby/jdbc/ClientDriver
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
Tried an alternative:
classLoader = com.mathworks.jmi.ClassLoaderManager.getClassLoaderManager;
driverClass = classLoader.loadClass(driverClassName);
That seemed to work, created objects "driverClass, type 1x1 java.lang.Class" and "classLoader, value 1x1 com.mathworks.jmi.ClassLoaderManager"
Then I tried
DriverManager.registerDriver(driverClass.newInstance);
which reports error
Undefined variable "DriverManager" or class "DriverManager.registerDriver".
and if I try to create a sample database using
cxnStr = 'jdbc:derby:sampleDB:create=true';
cxn = java.sql.DriverManager.getConnection(cxnStr);
I get
Java exception occurred:
java.sql.SQLException: No suitable driver found for jdbc:derby:sampleDB:create=true
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
I really don't know what I'm doing here; just copying other's code from around the web. Any suggestions on what to try next?
Since you're just getting started with Derby, can I recommend that you take an hour or two and run through the Derby tutorial: http://db.apache.org/derby/docs/10.11/getstart/cgstutorialintro.html
Also, can I recommend that you get in the habit of downloading Derby from the Apache website rather than other Internet sites? The copies of Derby on other sites are probably fine, but it seems most reliable and safest to get Derby from the Apache website: http://db.apache.org/derby/derby_downloads.html
Most of what you did in your description seems OK to me; I suspect the place where you went astray is when you unzipped derbyclient.jar itself.
Although a '*.jar' file is in fact a valid ZIP archive, you are not expected to unzip those packaged jar files. Instead, you should leave the jar as 'derbyclient.jar' and then set your CLASSPATH to include 'derbyclient.jar' as one of the entries in the CLASSPATH list.
Lastly, note that the JDBC Connection URL
jdbc:derby:sampleDB:create=true
is a correct JDBC Connection URL for the embedded configuration of Derby, not for the client-server configuration of Derby.
So even if you get a good copy of derbyclient.jar into your CLASSPATH correctly, you won't be able to use
jdbc:derby:sampleDB:create=true
Instead, you'll either have to use a client-server style JDBC Connection URL, such as:
jdbc:derby://my.server.name:1527/sampleDB
(and learn how to operate a Derby Network Server), or you'll need to switch to using the Embedded Driver (org.apache.derby.jdbc.EmbeddedDriver).
For more information about this notion of configurations, see: http://db.apache.org/derby/docs/10.11/getstart/cgsquck70629.html
And for more information on the JDBC Connection URL and the two JDBC driver classes, see: http://db.apache.org/derby/docs/10.11/getstart/cgsquck19524.html
Once you've had a chance to work through the Derby Getting Started guide, I recommend asking some follow-on questions based on what you learn during that experience.
I thought the Type 4 JDBC driver was pure Java and wouldn't require native libraries.
When I put db2jcc4.jar in the WEB-INF/lib directory of my Tomcat app packaged as a .war file, I get the following error when attempting to use the app: Got SQLException: com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.12.55] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError
The relevant application code is as follows and the exception is thrown due to the last line in the listing:
import com.ibm.db2.jcc.DB2SimpleDataSource;
// ...
DB2SimpleDataSource main_db2_data_source = new DB2SimpleDataSource();
main_db2_data_source.setUser(main_database_user);
main_db2_data_source.setPassword(main_database_password);
main_db2_data_source.setServerName(main_database_host);
try {
Integer main_database_port_integer = Integer.parseInt(main_database_port);
main_db2_data_source.setPortNumber(main_database_port_integer);
} catch (NumberFormatException exception) {
throw new WebException("...");
}
Connection main_connection = null;
try {
main_connection = main_db2_data_source.getConnection();
I suspect the problem is that you haven't told it to use the type 4 driver - the same jar file contains both type 4 and type 2 drivers, I believe.
Try:
main_db2_data_source.setDriverType(4);
The db2 driver needs another jar that includes the license.
This license controls the connection type. If you are going to use "db2 connect" to connect to a mainframe as an i series you should use the corresponding license. If you are going to connect to a Linux UNIX or Windows server, the license is included when you get the "Data server client for JDBC"
Also try this:
Goto Configure Build Path --> Libraries
--> JRE System Libraries
--> Native Library Location : Set this to %DB2HOME%/BIN
(which is where db2jcct2.dll is saved)
Recently i have faced this issue, when i was connecting to DB2 from Glassfish server. for this i have followed below steps and resolved this issue.
Please check it the below steps
step1) i have checked DB2 details in Domain.xml file.there i have seen only
username,pwd,databaseName,serverName ,portnumber, But i havent see DriverType.
Means Type of driver is 2 or 4.
2)for adding Type of driver i have logged into the Glassfish server admin console
Resources-->JDBC-->Connection pool -->our poolname --.add extra property
here i haved added as drivertype is 4.
Hence my problem has been solved
Thanks,
Ramaiah Pillala.