We have a Java servlet running on Windows through Tomcat and a recent SQL server database migration caused issues that have so far been resolved by upgrading the sqljdbc to sqljdbc4.jar. This has worked fine on 32bit operating systems but it still seems to hang and timeout on a 64 bit server. The top error message in the logs is;
org.hibernate.exception.GenericJDBCException: Cannot open connection
Is there a 64bit version of this driver? So far I have not found one. Is there something else that I have configured wrong?
Generally jar files are platform independent. A jar containing class files can be used on 32 and 64 bit JVM.
Your problem could be that you still need the suitable JDBC driver. See http://technet.microsoft.com/en-us/library/ms378422%28v=sql.110%29.aspx
It states that you need sqljdbc_<version>_enu.exe installed. I'm guessing there is a difference between version 3 and 4.
Related
I am running Cassandra 3.7 on an Ubuntu Server 16.04 LTS 32bit machine that I'm re-purposing from storage. I managed to properly configure the JVM to operate within the 32 bit environment. Nodetool status works fine. But I am having a hard time getting CQLSH to work. I end up with the following error:
('Unable to connect to any servers', {'127.0.0.1': ProtocolError("cql_version '3.4.2' is not supported by remote (w/ native protocol). Supported versions: [u'3.4.0']",)})
Obviously there is some version conflict here but I'm confused as to why and how to fix it. I had a previous 3.0 install of Cassandra that I configured cassanda-env.sh to properly start the JVM. I kept that .sh file when I installed up to 3.7. I updated cassandra.yaml with the new install.
So my question here is: does Cassandra 3.7 support CQL 3.4.2? If not then why does it appear to ship with it? If it does not, what do I need to do to downgrade to CQL 3.4.0? If it does support it and my configuration files are wrong then what's the error and how do I fix it? Or, is there another configuration that I'm completely missing here?
Here are my current configurations:
cassandra-env.sh: https://www.dropbox.com/s/dcs99hgry5behqd/cassandra-env.sh?dl=0
cassandra.yaml:https://www.dropbox.com/s/boi8bh7gin0390f/cassandra.yaml?dl=0
Any assistance greatly appreciated.
EDIT: Figured out, with the help of the first answer, that I had an older instance of the server running. I couldn't get it to start with the correct version...so then I deleted cassandra from /etc/init.d and now I can't get the debian package to automatically register the service.
EDIT2: Downloaded cassandra script from git repo and now cassandra will start again after rebooting. Now cassandra -v shows me:
3.7
Which what I wanted to see and solved my issue pertaining to the version conflict. But now unfortunately I see a new error:
Connection error: ('Unable to connect to any servers', {'127.0.0.1': TypeError('ref() does not take keyword arguments',)})
This problem is addressed in: cqlsh connection error: 'ref() does not take keyword arguments'
It looks like you're running the 3.7 cqlsh against an older server instance. First, be sure you are actually running Cassandra 3.7 (you can probably just check the jar path or look in the logs).
If you want to connect using the advertised cql_version there is a command line option:
https://github.com/apache/cassandra/blob/cassandra-3.7/bin/cqlsh.py#L222
select release_version, cql_version from system.local;
(or just look at the cqlsh welcome header) to see what these parameters are.
I have made a simple java task to make query to Ms sql DB on windows, using jdbc library.
The program runs perfectly on my eclipse. I want to use it as an exe file (so I can send it to friend so he can use that as well).
I made a jar (using the export option on eclipse) so he can execute it as an exe file on windows. The problem is when he runs the jar file on windows for some reason the results of the query are empty. I am not sure what exactly is the problem.
It's not on localhost. This is how I connect -
String connectionUrl = "jdbc:sqlserver://**.***.***.***;" + "databaseName=&&&&&&&&;user=&&&&&&&&&&&;password=$$$$$$$$";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl);
This is the error I get - not sure how to handle it:
java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.8 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0
I have sqljdbc4.jar and sqljdbc4.jar files on that folder.
Any thoughts?
Thanks!
It sounds like you need to modify your program so that it captures and prints out all runtime errors and warnings.
It also sounds like you want to add a "check health" feature to verify:
the program runs on your friend's PC,
the program connects to the MSSQL server,
the expected database is found on the server, and
the expected data exists in the database.
==================================================
ADDENDUM:
Thank you for updating your post and sharing the real problem:
This is the error I get - not sure how to handle it:
java.lang.UnsupportedOperationException: Java Runtime Environment
(JRE) version 1.8 is not supported by this driver. Use the
sqljdbc4.jar class library, which provides support for JDBC 4.0
It sounds like you compiled on an older version of Java (that's fine), with an older MSSQL/JDBC driver (that's fine, too) ...
... but your friend has a NEW JRE 1.8 which won't work with the new driver.
TWO SOLUTIONS:
Have your friend uninstall his JRE and then do a clean install of your Java version. For example, you can find older JRE 1.7 here:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
Update your MSSQL driver to a current version (sqljdbc 4.2 is a good choice), verify that it works for you, then have your friend install the same MSSQL driver. You can download it here:
https://msdn.microsoft.com/en-us/library/mt484311%28v=sql.110%29.aspx
PS:
A third option - perhaps best - is for both of you to install the same version of Java and the same version of the MSSQL JDBC driver.
PPS: In the future, if you have an error message, please copy/paste it verbatim in your original post. A good error message is very often enough to resolve the problem immediately.
I am trying to make a connection to oracle through java program. Following is the configuration.
Windows 7, 64 bit.
JDK 1.6
Oracle client 11g R2, 64 bit.
ojdbc6.jar in the class path of my standalone application.
But I am getting following exception-
"java.lang.UnsatisfiedLinkError: \bin\ocijdbc11.dll: %1 is not a valid Win32 application"
I googled alot but was not able to figure out the solution.
Please help me solve this problem.
Thanks in advance.
This error seems to be related with the compatibility of the OCI driver version with your Windows version.
Check if your OCI driver is compatible with a 32 bit architecture or else is for a 64 bit (and hence the error).
Here (https://forums.oracle.com/forums/thread.jspa?threadID=2189215) you can find a close related error (same error, for a different library), which finally was fixed downloading the S.O. specific version of the library and reinstalling it.
EDIT: so, after your edition, it seems that you have to install the 64 bit JDK and run your application on it, as your driver and your OS are aligned (64 bit).
This error may also come from 64 bit version of Java 7 and using 32 bit Oracle drivers. An application I used was supposed to use 32 bit Java 6, but an administrator installed Java 7, which apparently caused this error.
This error only happen on windows, to solve just copy your dll's into C:\Windows\System32, it works for me!
Firstly, you should have Oracle client 12 of 64 bit installed.
Secondly, copy ocijdbc11.dll to JDK--> inside bin folder and also to C:\Windows\System32 folder.
This should probably work.
I have some database import and export ant scripts that run little java programs to import and export data to and from oracle 11g.
The scripts used to work on Vista 32 bit, but stopped working with Windows 7 64 bit. There are two versions of ocijdbc11.dll that I can use.
When I use the 64bit version, the error message is: java.lang.UnsatisfiedLinkError: C:\tools\oracle\ocijdbc11.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform.
When I use the 32bit version, the error message is: java.lang.UnsatisfiedLinkError: C:\tools\oracle\ocijdbc11.dll: %1 is not a valid Win32 application.
Does anyone know what I would need to change to fix this?
Sorry, I'm not a windows guru, but I also use an 11g from windows java, but not with the oci driver, but the ojdbc14.jar which contains the thin driver. This driver does not need a native dll as I know.
The 11 in the jar is not the oracle server version, but the JDK version to be used with. So the ocijdbc11 is a JDK 1.1 compatible driver. You should use ojdbc14.jar, ojdbc5.jar or ojdbc6.jar (ojdbc14.jar also works with Java 6, but ojdbc6.jar not with Java 1.4).
For years, on 32-bit systems I have never had a problem. Why can't I use 64-bit Java ODBC driver with a Access database on Windows Server 2008? Is the ODBC driver on a 64-bit system written in 32-bit code or something? Here is the error I see, using a 64-bit JDK1.6.018 :
java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3073)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
.....
I suspect that the Access driver is 32-bit because it doesn't show up in the 64-bit ODBC control panel for windows. Only two 64-bit drivers (for SQL Server) are visible in the "Drivers" tab of the ODBC control panel.
So, what can I do? I would rather not have to use SQL Server and the JDBC Type-4 driver (but that would be my last resort).
Have you tried launching the 32-bit ODBC manager from Windows 2008 - to see if that helps you diagnose the issue?
The 32-bit version of the Odbcad32.exe file is located in the %systemdrive%WindowsSysWoW64 folder
I had same problem. The cause was that i was using 64 Bit ODBC DSN with a 32 Bit JDK. These should be same architecture (both ODBC DSN and JDK need to be either 64 bits or 32 bits). If you would register ODBC DSN on 32 bits and calling from a 64 bit application (64 bit JVM) you would get an error that DSN source is not found (So for the application to see the ODBC source - the JVM you are running the app should be same architecture as ODBS DSN: both needs to be 64 bits, or both 32 bits). Hope this helps.
If you use Microsoft Office 2010, which will return into the 64 bit architecture.
So, it will remove this error related to architecture mismatch between driver and the application.
I had the same problem and the solution, in my case, was to use a 32-bit JDK.
In my case, I had a 32 bit JDK 6u45 on a XP that used the jdbc:odbc driver to query a .accdb file. So I had a 32 bit JDK and also a 32 bit MS Office which automatically installed the necessary driver in my computer when I installed it.
Then I moved the project to a Windows 7 with a Netbeans 7.3 with a 32 bit JDK 6u45 BUT a 64 bit MS Office 2013 so that seems to be the problem, If you have a 32 bit JDK installed then you need a 32bit version of Office (with the proper driver that comes with that Office version). And the same with 64 bit version.
In my case I searched Oracle's Java archive for the 64 bit version of JDK6u45 and changed the JDK of the project to the 64 bit version.
Microsoft Access in Office 2010 will have a 64 bit version. Earlier versions of Microsoft Office are 32 bit only.
Using SQLExpress is both free and easy enough to use, and Access and Java can connect to it, so it seems like a good choice.
Since you said that was a last resort, the other option is to run the 32-bit JDK, which should run fine on Server 2008.