H2 console (http://localhost:8082/login.jsp) has the option to look at details of any database, where should we copy the jdbc driver if we have tp talk to the mysql or other database servers. Copying the jdbc driver file (mysql-connector-java-5.0.8-bin.jar) under bin directory didn't seem to help
Note: My H2 server is running as a service
To use other databases (for example MySQL), the location of the JDBC drivers of those databases need to be added to the environment variables H2DRIVERS or CLASSPATH before installing the service. Multiple drivers can be set; each entry needs to be separated with a ; (Windows) or : (other operating systems). Spaces in the path names are supported. The settings must not be quoted.
I just put the driver(s) on the classpath when I start the server:
classpath=.:/opt/h2/bin/h2.jar:/opt/derby/lib/derby.jar:...
server=org.h2.tools.Server
java -cp ${classpath} ${server} -tcp -web ... &
Alternatively, this is one of the rare times you might add a JAR to one of the java.ext.dirs. You can see what's available on your platform:
System.out.println(System.getProperty("java.ext.dirs"));
Related
Spring web application with log4j2 implemented in tomcat 8 running in windows and linux servers.
In windows server
CATALINA_OPTS specified in setenv.bat file
set "CATALINA_OPTS=-DLOG_FOLDER=D:\apache-tomcat-9.0.22\customlog"
log4j2.properties file is inside WEB-INF\classes\config\
appender.rolling.fileName=${sys:LOG_FOLDER}\logger.log
appender.rolling.filePattern=${sys:LOG_FOLDER}\logging-%d{MM-dd-yyyy}-%i.log.gz
In linux server
CATALINA_OPTS specified in setenv.sh file
set "CATALINA_OPTS=-DLOG_FOLDER=/opt/tomcat01/customlog"
log4j2.properties file is inside WEB-INF\classes\config\
appender.rolling.fileName=${env:LOG_FOLDER}/logger.log
appender.rolling.filePattern=${env:LOG_FOLDER}/logging-%d{MM-dd-yyyy}-%i.log.gz
log folder is always created like '${env:LOG_FOLDER}' or '${sys:LOG_FOLDER}'
You should use ${sys:LOG_FOLDER} in both cases:
${sys:property_name} retrieves the Java system property of that name,
${env:variable_name} retrieves the OS environment variable of that name.
See Log4j 2 Lookups for more details.
There are also other problems in your configuration:
if you start Tomcat on Windows as a service, setenv.bat is not used. You should add -DLOG_FOLDER=D:\apache-tomcat-9.0.22\customlog to the Java tab of the Tomcat Monitor application (bin\tomcat<version>w.exe).
on Linux you are using the wrong syntax to modify an environment variable (Microsoft's syntax), use:
export CATALINA_OPTS="-DLOG_FOLDER=/opt/tomcat01/customlog"
instead.
Remark: If you want to use environment variables instead of system properties, you can use:
export LOG_FOLDER="/opt/tomcat01/customlog"
on Linux, while on Windows you need to run:
tomcat10.exe //US ++Environment="LOG_FOLDER=D:\apache-tomcat-9.0.22\customlog"
See Procrun documentation for more details.
I've installed Sqldeveloper Version 19.1 64-bit Version on an enterprise PC with Win10-64bit.
It works fine with embedded jdbc-client, but I need to get it working using the Oracle OCI-client. One reason is the much better support to cancel long running queries.
Using an OCI-client (thick-driver) requires for sure a client like instantclient_12_2.
I have no admin privileges on my workstation and so copied the full instantclient_12_2 to the enterprise PC.
Since I'm not allowed to change the %PATH% myself, I created a start.bat file with required settings, because without, it also won't work (already tried).
PATH="C:\Users\myuser\OneDrive\Oracle\instantclient_12_2";%JAVA_HOME%;%PATH%
C:\Users\myuser\OneDrive\Oracle\sqldeveloper64\sqldeveloper.exe
When I try to configure another Oracle-Client without this change, I get another error, that PATH to instantclient needs to be defined before any others.
Now, starting sqldeveloper with this bat-file works fine. Connections can be established using the internal jdbc client.
Then, I've configured the Oracle Client in SQLdeveloper (Preferences/Database/Advanced) and selected the instantclient directory.
Pressing the "Test" button opens the Messages log "Oracle Client Test Results - Log" and shows an error.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occured, Program will exit.
Unrecognized option: -
Now, I'm lost, because I'm not a Java-Expert. I'm wondering, why sqldeveloper as Java-tool is running, but the instant-client says it can't create the JVM.
The reason for me to use OCI-client is, that it has e.g. better support of User-breaks.
Without admin privileges and no permission to change your %PATH% env permanently, you only need to install the whole directory somewhere and add a .BAT file, that changes environment temporarily before calling SQL-Developer.
Install complete SQL-Developer e.g. in C:\myprogs\sqldeveloper
Install instant-client somewhere, e.g. in C:\myprogs\instantclient_12_2
Create .BAT file, e.g. C:\myprogs\sqldeveloper\startsqldev.bat with following content:
set PATH=C:\myprogs\instantclient_12_2;%PATH%
REM start sqldeveloper
"C:\myprogs\sqldeveloper\sqldeveloper.exe"
It works for versions > 20 as well ;-)
Meanwhile, I've solved it.
Result of testing:
Testing the Instant Client located at C:\Users\myuser\Oracle\instantclient_12_2
Testing client directory ... OK
Testing loading Oracle JDBC driver ... OK
Testing checking Oracle JDBC driver version ... OK
Driver version: 12.2.0.1.0
Testing testing native OCI library load ... OK
Success!
Reason were following mistakes:
Forgot "set" in front of Variable assignment (because I'm usually using Unix)
Used quotation marks during Variable assignment, which are taken as part of the value (also different to UNIX).
Added JAVA_HOME and JRE_PATH
See below my complete bat-file (adapted, because of some secret information within pathnames):
REM Optional: setting of USE_OS_DATETIME_FORMAT changes DATE-Format
set USE_OS_DATETIME_FORMAT=1
set PATH=%USERPROFILE%\OneDrive - myCompany\Oracle\instantclient_12_2;%JAVA_HOME%;%PATH%
REM start your preferred sqldeveloper
"%USERPROFILE%\OneDrive - myCompany\Oracle\sqldeveloperx64.20.2\sqldeveloper.exe"C:\Users\myuser\OneDrive - myCompany\Oracle\sqldeveloperx64.19.1\sqldeveloper.exe"
Additionally, I've added a shortcut to the bat-file and now I can start it simply with CRTL-SHIFT-S ;-)
BTW: Same solution works fine on Win10 as well
This is maybe not an issue for who knows how config.sh work when you config weblogic after you installed it into your disk.
My question is: After I installed weblogic 12cR2. How I can add a customer JDBC driver jar file into weblogic 12cR2 before I run config.sh as when I do config, system need use it to connect my database?
I tried to put it in:
$ORACLE_HOME/oracle_common/modules/db2jcc4.jar
and then, I add the full driver jar file path into java class path with this file:
$ORACLE_HOME/oracle_common/common/bin/commExtEnv.sh
Then I restart my Mac and then, redo config.sh to set up component datasource (em module need it) for RCU. Weblogic blaming driver not found.
but, if I start weblogic server by using $DOMAINH_HOME/startWebLogic.sh. weblogic can find that driver in the path.
What's wrong I did? Please advise!
You don't have to change "commExtEnv.sh". In Weblogic 12c you can create a file called "setUserOverrides.sh" in order to customize the Weblogic starting paramters like the classpath. In your case you could have something like this:
# add custom libraries to the WebLogic Server system classpath
if [ "${POST_CLASSPATH}" != "" ] ; then
POST_CLASSPATH="${POST_CLASSPATH}${CLASSPATHSEP}$ORACLE_HOME/oracle_common/modules/db2jcc4.jar"
export POST_CLASSPATH
else
POST_CLASSPATH="$ORACLE_HOME/oracle_common/modules/db2jcc4.jar"
export POST_CLASSPATH
fi
The "setUserOverrides.sh" must be placed in the bin folder of your domain, where setDomainEnv.sh, setStartupEnv.sh and startWebLogic.sh reside.
You can find more information here in the Oracle documentation: http://docs.oracle.com/middleware/1212/wls/START/overview.htm#START250
I have an application packaged as .war file. I want to deploy this web application to Glassfish v4.0 server using this command:
./asadmin deploy --force=true --createtables --contextroot test /tmp/test.war
Deployment without --createtables parameter works fine, however I want the tables to be generated/updated during the deployment. On my local server where I have only one JDBC resource defined in glassfish it works fine. But on the test server there are more JDBC resources defined with limited privilegies and one JDBC resource that I want to use just for this task. How do I tell glassfish to use this particular JDBC resource when creating and updating tables?
Thank you
You need to provide {true|false} to the --createtables option:
./asadmin deploy --force=true --createtables=true --contextroot test /tmp/test.war
I have a weblogic cluster set up across two machines in a staging environment. I'd like to set up JPDA on at least one of the weblogic instances so I can debug remotely. Generally I use wlst.sh and jython scripts to startup the cluster via:
startNodeManager(...)
nmConnect(...)
nmStart(MyAdminServer)
connect(...) #connect to the admin server
start(...) #start the cluster
Where should I put the -Xdebug Xrunjdwp:transport... incantation so that I can attach to one of the weblogic instances? I had no problem setting this up on a single instance through my domain's startWebLogic.sh, but it doesn't seem to work with the cluster.
From here: https://forums.oracle.com/forums/thread.jspa?threadID=2233816 it looks like I want to put the debug string in startManagedWeblogic.sh but that doesn't seem to work with my jython script either.
Figured it out, from http://docs.oracle.com/cd/E13222_01/wls/docs90/server_start/nodemgr.html#1081870:
4. The Administration Server obtains the domain configuration from its config directory
I checked out the config directory under my domain and there was a suspicious file called config.xml. Within this file is the configuration for the weblogic nodes and where you want to put your JDPA config:
<server>
<name>my-target-machine</name>
...
<server-start>
...
<arguments>(your other config stuff) -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n</arguments>