I have a strange problem with jdbc connection to an oracle database server.
We've applications on a tomcat server running. These application use an oracle database. All applications use the same credentials.
Applications running fine the whole day. At night there is no activity. In the morning we get a few (2 or 3) ORA-01017 (invalid username/password) errors when the applications trying to reconnect themselves to the database.
Then reconnection works and the applications will operate normal.
This works for some days (around 5 days) and then one or more of the application block! All reconnection attempts fail.
We've traced network communication and found that if the connection fails with ORA-01017 NO CREDENTIALS where sent.
Of course no one touches the system at night.
One attempt for a workaround is that we restart the tomcat server every morning at 6 o'clock to clean up every connection cache or pool. It does not help.
Whats wrong? Any ideas?
The continued 5 day interval in the appearance of a total blockage (while restating every day) looks very strange to me.
Config :
Database Oracle 10.2, JDBC Driver 11.2 thin, tomcat 6.0.24, JDK 6, OS is windows, some of the applications are Dialogs for the Avaya Voice Portal 5.0.
Our own (non VP) applications use simple Connections (no pooling).
The system was originally setup on a Windows 2003 server with a WAN between apserver and tomcat server.
The system is now migrated to a linux (CentOS) server near the database server and works fine. No ORA-01017 anymore.
For me incompatible version of OracleDriver was causing this issue Your application should either register oracle driver manually (which jar that I needed to work with was doing) or agter java 6 ojdbc.jar should be in the classpath for your application. So google compatible driver version for your oracle installation and either declare it in your pom file (with needed plugin to put it in the resulting jar) and reference it manually from code or put the ojdbc.jar somewhere your jar can see it Usefull links:
About connecting to oracle db: https://www.codejava.net/java-se/jdbc/connect-to-oracle-database-via-jdbc
About java classpath: https://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
Odd. Some ideas:
Log the user name and password for a few days just to make sure they are correct. Some bug in the code might overwrite a value that you don't expect.
Consider to use JNDI with a connection pool provided by Tomcat. DBCP has some really advanced options to check whether a connection is still alive and how to reconnect it. After that, you shouldn't see any connection related issues in your logs anymore. This would also improve security because none of the apps need to know the DB password anymore.
It might be a problem with resource leaks (happens if an app never returns the connection) but I'd expect a different error message, then.
Some databases (DB2, H2) allow to create views that make remote tables from other databases visible like local tables. Not sure whether Oracle supports this but if it does, then maybe the user name/password for this remote table is wrong.
Also consider the points in this blog post: Oracle ORA-01017 tips
At first glance, nothing in the post could cause your problems but maybe some script is manipulating the tnsnames.ora (for example distributing a new copy).
Or the DBA disabled all users for the time of the daily backup.
I'd check Oracle listener and trace logs. As Aaron Digulla said, it does sound like some resource exhaustion.
As Nikita Poberezkin said, I checked my JDBC driver versions and saw it was different from our test server. I removed it and installed the same exact version of the test server and I guess it's solved now.
Related
I am using Jmeter 2.13 version and with that I used to record many scripts earlier successfully without any issue . Now, my OS has been reinstalled and I am holding Windows 8.1 , 64 bit version.After re installation, I am not able to record HTTPS web applications even though my proxy configuration is correct. After I setup everything in Jmeter, and click on start from work bench and I navigate to the browser try to access the application, it shows "Server not found" message.
However, the scripts which I saved earlier are working fine without any issues. only the new recording is not working.
Help me with the possible solutions.
"Server not found" indicates that browser is unable to access Internet (or intranet).
Most likely you're sitting behind the corporate proxy server and in previous JMeter installation you had these proxy server details specified in system.properties file like:
http.proxyHost=10.20.30.40
http.proxyPort=3128
https.proxyHost=10.20.30.40
https.proxyPort=3128
Double check with your network administrator if this is the case, if yes - take steps from Using JMeter behind a proxy User Manual chapter.
You can also try out JMeter Chrome Extension as an alternative solution - in that case you don't have to worry about proxies and SSL certificates substitution.
In java, I use jdbc connect to sqlite. the following sentence works,
Connection conn =DriverManager.getConnection("jdbc:sqlite:C://Users//13149//Desktop//SqliteDB0.sqlite");
When I replace this with the following one.
Connection conn =DriverManager.getConnection("jdbc:sqlite://localhost:3306//Database//SqliteDB0.sqlite")
The first time, it does not give any error message, only stop there. However, as I run it again, it always gives error message. Anyone can help me? Thanks.
Maybe you have gotten the wrong idea. A SQLite database is simply a file...so, the first setup you provided works fine.
The setup you provided would have worked fine on MySQL, for example, since there's a database server running on 3306 port. Since SQLite isn't a client/server database, but a local file, the only viable option is pointing to its physical file.
In case this second setup is supposed to be running on your application server, you just have to create the SQLite physical file and point the connection URL to it, just like you did in first place.
If you really need, for example, to have the database running on another server (different from your application server) you should consider migrating to MySQL/PostgreSQL. Both of them will allow you client/server connection.
I do not want to install a database server on target machine. It is possible that we can simply ship a jar file with the database embedded in it, and not worry about installing a database server separately?
I created one application in netbeans using derby and it is working fine in my pc but when i am running on other machine it is giving me Error connecting to server localhost on port 1527 --> this error says that there is no Database running on port 1527. but i dont want that the client should take more efforts to start DB server and all technical process. It should be simply runnable when i start application Derby DB should start and when i close DB should close.
So what will be the solution for my problem?
And one more Question is Can i use derby database for large scale projects?
No, you don't have to install a database server on the target machine; Derby works just fine in embedded mode without a separate server.
However, if you want multiple client applications to be actively sharing the same data in the same database, you'll want to use the client-server mode, not the embedded mode.
And yes you can embed a jar with the database into your program. If you want to know how, read this documentation: http://db.apache.org/derby/docs/10.11/devguide/cdevdvlp24155.html
And yes you can use Derby for large scale projects. But it doesn't come with all the enterprise features (online backup, etc.) that a true enterprise scale commercial DBMS comes with.
But, since it sounds like you are just getting started with Derby, can I suggest that you please start with the Derby tutorials before you try these advanced configurations? Here is the link to the Derby tutorials: http://db.apache.org/derby/docs/10.11/getstart/
It may not be possible to give you very good advice without knowing a lot more about the application you're trying to build and the overall architecture you're trying to use.
I have, let's say, a root website with mysql db on a remote server.
I want to connect to that particular database (to make queries), from many other little websites (with lower priviledges).
Can this be done?
Language: jsp, java, php
Any particular problem? Just specify server address instead of 'localhost' in connection string.
You can also create dedicated user with minimal privileges for that.
The default configuration often contains a variable
skip-networking
which you need to comment-out in order to have networking enabled.
Yes it can be done, MySQL allows connections from remote hosts (assuming MySQL is configured to allow network connections and assuming the remote hosts are granted). In case of problem, the section 5.4.7. Causes of Access-Denied Errors lists most common problems and solutions.
In addition to the answers from Nikita Rybak andPascal Thivent, I'd like to note that most hosting providers don't allow queries from locations other than localhost.
I don't know how much access you have to the server configuration, but I would have saved myself a headache a while back when I first started experimenting with connections across domains/servers.
If the MySQL server is under your control, it's not difficult; you can find the procedure here. If it's not, the only thing you can do is beg the admin to do it, otherwise it's impossible.
I just want to know how I can start derby in network server mode and still be able to get an embedded connection?
Thank you.
You need to launch Derby in "embedded server mode". If you are already using Derby in embedded mode, this can be enabled by providing the necessary files in your classpath, then specifying a handful of command line arguments when launching the application.
First make sure the following jars are in your application's runtime classpath.
derby.jar derbynet.jar
Then add the following command line options to the Java command used to launch your application. If the class files are missing, these options will have no effect.
-Dderby.drda.startNetworkServer=true
-Dderby.drda.portNumber=8011
I'm running Derby from within a servlet hosted by Tomcat, so I added these options to the catalina.bat file.
Start up your application and check the list of open network sockets.
netstat -an | find "8011"
You should now see Derby listening for connections on 8011. Its now possible to connect to the database using Derby's client driver (derbyclient.jar). The instructions at http://docs.oracle.com/javadb/10.3.3.0/adminguide/radminembeddedserverex.html cover this part pretty well.
It was hinted that running Derby in this mode may be discouraged. I don't believe that to be the case. Your application will continue to access the database using the embedded driver, while other software is now permitted access using the client driver.
The Embedded Server mode sounds like what you are asking for. It allows you to start a network server when you start the embedded database.
It sounds contradictory that you want to start derby in network server mode and get the embedded driver. Even if this might be possible, it is definitely discouraged. You should decide on whether you want to use Apache Derby in the network mode using the DRDA or as an embedded driver and stick to that decision.
Here you'll find a tutorial on how to use the network driver:
http://db.apache.org/derby/papers/DerbyTut/ns_intro.html
Some one correct me if i am wrong, Both will run on separte ports. So you can connect to the required one using the proper connectionName, right?
#pawelocue: Sorry, but this is wrong. Using the embedded server mode is perfectly alright and sometimes very useful. It is definitely not discouraged.