I'm having some issues when I try to run my program. it appears an error:
java.lang.Exception: java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0
And I already add the library in my program, using the proper jre enviroment, but it keeps sending this error when they connect to my database. I tried every solution in stackoverflow for this issue and didn't work.
I verify that is the right sqljdbc4 too, I don't know what else to do.
Related
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.
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.
I'm running OpenGTS on a Windows 2012 server with Tomcat 7 and Java 1.7. I'd like to use SQL Server as I already have this installed. The specification was very clear on how to update the common.conf to point to the proper sql server database. However, when I run checkinstall.bat, (or any other DB tool for OpenGTS) I get an exception:
SEVERE: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Exception in thread "main" java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
at com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:304)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.opengts.dbtools.DBConnection.getConnection(DBConnection.java:659)
at org.opengts.dbtools.DBConnection.createStatement(DBConnection.java:769)
at org.opengts.dbtools.DBConnection._execute(DBConnection.java:856)
at org.opengts.dbtools.DBConnection.execute(DBConnection.java:811)
at org.opengts.dbtools.DBConnection.execute(DBConnection.java:793)
at org.opengts.dbtools.DBFactory.tableExists(DBFactory.java:1648)
at org.opengts.tools.CheckInstall.main(CheckInstall.java:2100)
I'm pretty sure I've REMOVED or RENAMED sqljdbc.jar (perhaps renaming is not enough) in folders containing included jar files. I don't see any config file specifying this. I'm not a Java developer usually, but I feel there should be a simple thing I can do to "use" the sqljdbc4.jar that I have. I just don't know what that simple thing is... Any help would be appreciated!
It would certainly help if the SEVERE warning above which says "this" driver is not supported by JRE 1.7 would be perhaps more specific and let me know what driver "this" is...
Arg. There are too many JRE's on this machine! I found I had renamed the file in another JRE folder in lib\ext, so I removed that sqljdbc.jar file entirely. Now it is gone. Now the program works.
When I try to run Java application, I receive the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
I don't have a file ocijdbc9.* on my PC, but I have ocijdbc10.dll in %ORACLE_HOME%\bin.
%ORACLE_HOME% is correctly specified, so I think the problem is that the application is searching for the wrong version (9 instead of 10).
Both Oracle and Java Builder are freshly installed, so the problem may be in project preferences? Do you have any ideas on how to search for the place where the wrong version is specified?
You're missing a file from your java CLASSPATH.
You need to add the OCI jar to your classpath.
For my oracle 10.0.2 install on windows it's located in
%ORACLE_HOME%\jdbc\lib\ojdbc14.jar
If your application requires ocijdbc9 then you'll have to download it from somewhere and add it to the CLASSPATH. I don't know where to download it from, try the oracle site
an additional tip:
if you're using oci jdbc urls; it is always better to use the jar library of your oracle client version.
please check this address for these libraries: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
for example if your client is Oracle 10.2.0.4, then you'd better use this client's ojdbc14.jar for java >= 1.4 and classes12.jar for java <= 1.3
note that until Oracle 11, jdbc libraries have the same names in every version such as ojdbc14.jar and classes12.jar.
You need to pass -Djava.library.path=YOUR_ORACLE_HOME\bin to the JRE as a runtime parameter
So....
java [other java switches + runtime parameters] -Djava.library.path=YOUR_ORACLE_HOME\bin run-classname
I think it is because you have not yet installed Oracle Client.
After installing it, maybe it is ok
When using ANT to build my Java application I keep getting this error. I have tried multiple times to use SQLJDBC.JAR and SQLJDBC4.JAR but continually receive this error message. I am completely stumpped why this error is received even after upgrading to sqljdbc4.jar.
[javadoc] java.lang.UnsupportedOperationException:
Java Runtime Environment (JRE) version 1.6 is not supported by this driver.
Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Refer to this link:
http://msdn.microsoft.com/en-us/library/ms378526.aspx
"sqljdbc4.jar class library requires a Java Runtime Environment (JRE) of version 6.0 or later."
So if you aren't using a JDK 1.6 or later when compiling, you will get an error when using sqljdbc4.jar.
If you are using JDK 1.5 or earlier, then you need to be using the sqljdbc.jar, which you can get from here.
Also, one tip with ANT is that you can use "ant -verbose" to help determine which libaries it's finding on the classpath to make sure it's using the sqljdbc JAR you expect. Also, make sure to confirm which version of the JDK you are compiling with. You can set the JAVA_HOME environment variable to point to a different JDK to compile with.