I am using oci driver to connect to oracle 11.2.0 on Linux, I found that under LD_LIBRARY_PATH, there is only libocijdbc11.so but any ojdbc jar files, is that right? For database connection, am I supposed to add this *.so file to java CP?
I can't test it right away because it is on customer production environment, so just want to get what's the gist first, thanks for any guide!
you can find the ojdbc*.jar files under $ORACLE_HOME/jdbc/lib
and the *.so files must not be included in your CP, but the environment variable LD_LIBRARY_PATH have to be set to the right directory
In Eclipse under project folder->WEB-INF->lib then Right click lib folder->
Build Path->Configure Build Path->Under Libraries->Click on Add External Jars->Computer->Local Disk (C:)->oraclexe->app->oracle->product->10.2.0->server->jdbc->lib->now select ojdbc14.jar
Directly the path is
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
You will get those jars when installing the Oracle Client, the ojdbcX.jar files appear in ORACLE_HOME/jdbc/lib.
The *.so isn't a java library, and it shouldn't be included in the classpath. It should be available in LD_LIBRARY_PATH.
Check out the Verification of a JDBC Client Installation section in the Oracle guide.
Related
I am writing a java program in eclipse. It needs to import import oracle.xml.diff.XmlUtils;
oracle.xml.diff.Options;
But eclipse is not recognizing it and also I cannot find these jars online. Can anyone refer me any site from where I can download these jars.
You need xml.jar file that ships with Oracle Database 12C or later.
Download the database from here and install it.
xml.jar can be found in /lib directory under the shiphome directory.
Sorry there's no easier way to get the jar at the moment.
After installing the above database then xml.jar is present at:
D:\app\"username"\virtual\product\12.2.0\dbhome_1\sqldeveloper\modules\oracle.xdk
Type the "username" otherwise you may not able to open it.
I installed my database in the D: so it displays that.
First, open the installed folder and then move to the virtual, product, then 12.2.0 or the version you downloaded then select dbhome_1 and select sqldeveloper and then modules and then oracle.xdk there you can find xml.jar.
I see there are other similar questions, but none of them cover my exact situation.
I'm migrating an Eclipse based web service from FreeBSD 9.2 and Tomcat7 over to FreeBSD 10.0 and Tomcat8. I've deployed my .war on the new server and it runs, right up until it has to do a SQL access, where it fails with "cannot load net.sourceforge.jtds.jdbc.Driver". I'm not sure what's missing. We don't load a driver in lib, it's all bundled into the one .war file (which works fine on the old machine). I've searched the tomcat config files to see if there's any pointers that need to be set, but I'm coming up empty.
Download the jTDS driver from here. Copy it into the Tomcats lib folder. Are you sure you are not using JNDI to retreive the datasource? If thats not the case, its better to include app specific jars in your project and not on the server, to avoid version conflicts with other projects.
Download ojdbc6 or ojdbc14 (which one usefull for Tomcat8)
copy to apache-tomcat-(version) >> lib file.
And in eclipse add ojdbc in Build Path >> order & export.
I'm running a JBoss server (inside Eclipse), with some Hibernate mixed in. I installed Oracle's ojdbc drivers from here:
Oracle Database 11g Release 2 JDBC Drivers
I specifically downloaded the file: ojdbc6dms_g.jar, which according to the site contains instrumentation to support DMS. However when I startup my AS server, I get the following:
Caused by: java.lang.ClassNotFoundException: oracle.dms.console.DMSConsole from [Module
"com.oracle:main" from local module loader #485fcf29 (roots: /usr/local/jboss-7.1.1-
final/modules)]
when the server is trying to get a new hibernate ejb exception.
I checked Oracle's jar file and sure enough it doesn't contain the class oracle.dms.console.DMSConsole, although from the notes on Oracle's site about the jar file, it seems like the jar file should contain the DMS classes.
Can anyone point me to the correct jar file? And when I do get the right file, where should this file be installed to, particularly with regards to Eclipse and JBoss?
Update: Just found another question asking the same thing here on SO.
The missing classes are indeed in dms.jar. But as I've seen asked elsewhere finding the dms.jar file is not easy. You won't find dms.jar at Oracle Database 11g Release 2 JDBC Drivers because as noted by Oracle: dms.jar is not shipped as part of the RDBMS product. It is only available as part of the Oracle Application Server product.
I hopped onto our server and grabbed the jar file from our Oracle installation directory. We have 11g installed. With 11g you should be able to find the file here:
$ORACLE_HOME/oc4j/lib/dms.jar
I got the same error for different reason and yes it was due to missing dms.jar file. I just had to find where dms.jar file was on our Oracle Application server (Release 12.2.3) and assigned it to the CLASSPATH. And it worked. Thanks for the pointing to the missing .jar file.
Out .jar file was in $ORACLE_HOME/lib/ folder. Changed the path value as :
CLASSPATH=$CLASSPATH:$ORACLE_HOME/lib/dms.jar and it started working.
Fyi..if it helps anyone i was trying to load BI/XML publisher DATA TEMPLATE using XDOLoader utility when i got this error.
-ppemavath
i too face this problem but when i removed all database related jars and added ojdbc6 (or ojdbc7) jar then application working fine. more details please see below link.
https://community.oracle.com/thread/2388722
Ok I am on Win Vista and correctly set my MAVEN_HOME, JAVA_HOME stuff. but I do not have a class path yet. I have also installed MySQL. now I have opened a Hibernate book and at the very first pages it says "make sure the jdbc driver is in your classpath" . I have also downloaded some Zip file that is ConnectorJ or some name like that which is basically the mySql driver for java... but my problem for now is this sentence that I have no clue how to do it: "make sure the jdbc driver is in your classpath"
would you please help me about this classpath thing?
thanks
Here is a good tutorial regarding, setting the class path. Further you might like to read Managing the Java classpath (Windows).
Having said that, you should not set the classpath for your driver in Windows environment variable. Instead, you should include that driver jar inside your IDE under project properties. But I noticed that you are actually using Maven. In this case you should look for the driver under Maven in order to fulfil that dependency. Maven will download the driver jar, if doesn't exist, and make it local.
In case, you are not using any IDE, then you can create a lib directory and tell the compiler that all required jars are in there, at the time of compilation/execution. You can find HOW, in the former link given above.
Since you are using Maven, you just need to put the JDBC driver as a dependency in your pom.xml file. Maven will add it to the classpath whenever it compiles/runs your application.
What you do when deploying your application is dependent on the technologies in use.
If it's a command line application create a %CLASSPATH% variable or add the path to the jdbc.jar file using the java -cp {path\to\jdbc.jar} option.
If it's a web application, you'll need to package the driver jar in your .war/.ear/.sar (the maven assembly plugin can do this) or include it in the ./lib folder of the application container and declare it as scope=provided in maven.
Steps to setup JDBC for Eclipse projects
Download JDBC zip archive from
https://dev.mysql.com/downloads/connector/j/5.0.html
Extract the file and copy the executable jar file to program files->Java->jdk->bin
Right click on the project and select Buildpath->Add external archives->(Jar file)
Compile the program
you can directly connect database by following steps:
1) download mysql-connector-java 5.0.8 and extract the files.
2) then place the folder in program files.
3) then simply add this library on your project by right clicking on it.
4) and here you go. Run your app with db connectivity.
I'm a beginner java developer and i'm not very confident with java world tools.
i'm using eclipse helios, jsdk 1.5, axis2 plugin and tomcat 6.0.29 on windows to port a very old webservice , preaviosuly deployed on a websphere.
I've added a tomcat server to my eclipse project, when i start the server i get the following message : the APR based Apache Tomcat Native library ... etc ... was not found on the java.library.path .
How do i change that variable (or any environment variable in general ) from inside eclipse ?
Then i've another problem i don't know if can be solved with some kind of configuration : i must use some third party .class library grouped togheter into a zip file. I've added the zip to the shared.loader property of the tomcat catalina.properties file and my project can't see them. If i rename the .zip file to .jar everything works fine . How can i use classes inside zip file without renaming it to jar ?
thank you in advance
A Jar is based on the same format as that of Zip. All the third party classes are bundled as Jars (Java Archives) and should be used like that instead of Zip. So if you happen to have a zip housing your classes you should rename it to jar as per java's conventions.
You can check where java.library.path variable is pointing to? using System.getProperty("java.library.path"); and see if the native libs are present in there..you should use the jar instead as its the standard format for archiving java class files
when i start the server i get the following message : the APR based Apache Tomcat Native library ... etc ... was not found on the java.library.path
The exact message is:
INFO: The APR based Apache Tomcat Native library which
allows optimal performance in production environments
was not found on the java.library.path
As you can see, the message is logged as INFO and the easiest thing would be to ignore it, especially in a development environment. But if want to make things more complicated, go to the Apache Portable Runtime (APR) based Native library for Tomcat and follow the install instructions.
(...) I've added the zip to the shared.loader property of the tomcat catalina.properties file and my project can't see them. If i rename the .zip file to .jar everything works fine . How can i use classes inside zip file without renaming it to jar?
In other words, using a (standard) *.jar worked, but a *.zip didn't. I'm tempted to answer: use a .jar extension.