Now, I have got a comment saying I should get the database connection from connection pool. And one more issue is that I have used the function System.getProperty("user.name") to get the username which i have logged in. But this code will be run on Unix which will not support this function. Any function where I can get the windows username. There is a function getUserPrincipal(), but this function returns a NULL. How to resolve this.
I configured a connection pool in tomcat 7. For every database activity I get a connection from the pool. Do I have to close the connection like other regular connection after the database operation is done? If I close the connection will it have any effect on the connection pool?
Yesterday, I established a connection with oracle 12c, codes is here:
ods.setURL("jdbc:oracle:thin:c##mytest/myt@//myhost:1521/orcl");Connection conn=ods.getConnection(); where "c##mytest/myt" is username and password. It worked well.
But, today, "IO Error:The Network Adapter could not establish the connection" appeared when I tried to run my program again.
I changed //myhost into 127.0.0.1, it worked again.(Before I did this, I checked lsnrctl and regedit and firewall....., no difference)
Here is my question:
1) What happens between //myhost to 127.0.0.1, hostname cannot be use to JDBC? If yes, how?
Besides, I have some other questions:
2) How import a *.dmp file which exported from 10g into 12c?
I have installed and configured Oracle Business Intelligence Applications on top of one demo eBS instance as a source. Now I would like to change the OLTP to a different eBS instance but am not sure which steps to take. I don't know if I can add new EBS connection pool and a new DataWarehouse Connection Pool in the administration and have old ones preserved or I need to overwrite the old ones? Or (ideally) can I just change the OLTP and overwrite the old DWH?
Any document supporting the process of changing the eBS OLTP database without new installation of the OBIAPPS?
I am working on netbeans IDE , but I understand how the application know the parametres for the connections. I understand what is a Context , specifically i understand this code about the init method
In the class that actually uses it I create a method variable for the connection object.
Closing the connection as well as pds.getConnection().close();e
I am thinking that at the most I should have only one inactive connection showing up when I monitor the session. How do I configure the pool as to only show on inactive connection? I am running the test queries once every five minutes. But I am opening three connections each time.
We have a J2EE business web application that runs in WebLogic. We noticed in application log files errors messages that seems like "No resource available in db pool", it means all the connection objects (to Oracle database) are used. Then the application is unstable and unseable.
I think the maximum number of connections configured in Weblogic pool has been reached due to an increase of users and activity. But when the workload decreases the application is still out of service. It seems connections objects are not relased to the pool. What can be the explanation for this issue ? Normally it is managed by the container (EJB3 for the business tier).
Once the limit of the pool is reached it is necessary to restart the server to solve this kind of error ?
I was wondering if I could take the following code and somehow put the connection to database in it's own class without the "public static void main(String[] args)" method. That way I could call it anytime i want to open a connection to the database.
Java Code:
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Sample { public static void main(String[] args) throws ClassNotFoundException
I am new to EJB; I am writing EJB (3.1) program in JBoss 7.1 - I am using MySQL DB with JPA. While executing the program, I am facing the Generic JDBCException: Could not open connection. It is happening only for certain tables in the database; but NOT for all tables. My code is able to access few of the tables in the same database. Here is my full stack trace: -
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
I'm using JSF framework. I can let Netbeans to create the persistence unit and hardcodes connection parameters into the persistence.xml file or i can use resource tag in context.xml file or using another file like property file or class for holding connection parameters like username and password; what is the most secure way or expert way to use connection properties in my app or there is no difference?
I am trying to make a simple login using netbeans, derby database included in netbeans and tomcat server. I made everything nice and separated: I have a model package with a class called DbConnector that has the following method:
Then i have another class, an userDAODB that has a password check method:
public boolean checkPassword(String user, String password) { try (Connection con = new DbConnector().connect(); Statement stmt = con.createStatement()) { //checks the password in the database
In the main method of this class i tested everything, it works very nice, logs me in, other methods work too, no problem what so ever.But then i go to my servlet:
public class LoginTest extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String username = request.getParameter("username"); String pass = request.getParameter("pass"); UserDAODB userDAO = new UserDAODB(); boolean authe = userDAO.checkPassword(username, pass);
[code]....
So when i start the webpage and i try to click on the login button I get a NullPointerException com.model. UserDAODB. check Password (User DAODB. java:14) - so line 2 here
I have been googling a bit, i placed the derby.jar and the derbyclient.jar in the lib directory of tomcat, i tried to modify the context.xml of my application, but then it wouldn't even start anymore.
I got the below exception .how to resolve this .It's receiving the data up to 10 min then suddenly below error happening. I have embedded the source code below
java.net.SocketException: Connection reset at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
I am unable to connect my javafx scene to mysql database. I get a java.lang.NullPointerException every time. I tried searching everywhere possible but no answers available. This is the Person class (super class for Teacher class):
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */
Below is a code of a simple file downloader in java. I want to detect an exception when the connection is broken in the middle of downloading a file. Now, I run the code and in the middle of downloading the file, i turn off my wifi with keyboard wifi off button. Doing this the program hangs forever without throwing any exceptions and without terminating. It seems it blocks forever.why is exception not thrown? Secondly, in the following code you can see this line //con.setReadTimeout(2000); which is currently commented out. Removing the comment and running the program, now if connection breaks in the middle by turning off wifi then it waits for 2 seconds and then if it cannot read then it terminates without throwing exception. So, again in this case why is it just terminating and not throwing any exception?
I am trying to get RJDBC to work so I can connect to Oracle from R doing some data analysis..
This connection string works for my local db which I have it running in my Virtual Box
con <- dbConnect(drv, "jdbc:oracle:thin:@//localhost:1521/orcl", "demo", "demo")
However, it does not work when I do it for the remote db that I really need to pull data from...
> con <- dbConnect(drv, "jdbc:oracle:thin:@//ymsdbppr-scan:1522/YMQCTPRD", "user_read", "user_read")
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], : java.sql.SQLException: Listener refused the connection with the following error: ORA-12514, TNS: listener does not currently know of service requested in connect descriptor
I have noticed an error, that makes sometimes troubles, when downloading jars from https addresses, when there are many jars to download..
Best example is by opening Javas on Java version checker. [URL] ....
I get also following log...
network: Connecting https://www.java.com/jsp_utils/jreverification.jar with proxy=DIRECT network: Connecting http://www.java.com:443/ with proxy=DIRECT network: Connecting https://www.java.com/jsp_utils/jreverification.jar with cookie "JSESSIONID=22ABBA2BE9B5789629C276AC35BDF969; s_cc=true;
Even if the address is https, java try to access via http protocol on port 443, and that leads sometimes to problems..
I have noticed this, when I have used URLConnection(HttpURLConnection) for my self, as soon Java sends http link on https address, the jar gets sometimes not loaded, and i get error about missing class that get called..
On http addres it is not so bad, since same protocol is used, but evidently, that is evil for https..
As you see, that happens already when loading Jar by Applet Starter and at all, it happens each time on any URLConnection
############################### Java Plug-in 10.13.2.20 Using JRE version 1.7.0_13-b20 Java HotSpot(TM) Client VM User home directory = X:Usersadmin ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect
I have a shop and I use visual studio.net to create an Inventory application to manage my shop. So I am familiar with vb.net codes.
Now, I'm trying to built another Inventory application for my shop using java, 'coz now I'm using Linux Ubuntu for my OS desktop and there's no visual studio.net in linux.
So in vb.net, there's a module that I use for database connection that I can call from any form that I needed.
I searched google for the equivalent module for java and there is none. But, there's an example that use a new java class.
Here's the code in MySQLConnect.java :
Java Code:
public class MySQLConnect { static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/dbInventory"; static final String USER = "root"; static final String PASS = "root"; public static Connection ConnectDb() {
I have a https connection from Client to Server and a malware in client. The malware modifies the message and compromises its integrity. I am using a proxy to check the Integrity of the message after the malware has changed the message and before sending it over the internet to the server.
Now, How can I check the Integrity of the message (Sure that it has not been modified by any Man in the Middle) for the second half of my communication channel(Which is from Client to the Server over the internet).
I see few conventional approaches of CRC or Checksum will work. But I am looking for some non traditional or upcoming approaches.
Ideally SSL Data shouldn't be able to be decrypted by any MIM. But my assumption is that any Protocol is subjected to attack and compromised in real world and few recent studies are proving that https is breakable. Thus, I am trying to perform a What if analysis? On the client side, lets say malware is not more powerful than just modifies the transaction amount and destination account number in a typical online Baking transaction.
I have created a sample java web service client using Apache Axis. It works well with basicHTTPbinding (without security and Basic authentication).I am not able to make a secured communication. How to make it work in a secured way using NTLM or any other security.
Suppose I issue a command such as "ALTER SESSION SET WORKAREA_SIZE_POLICY=MANUAL" inside a stored procedure called via JDBC and then release the connection back to the pool. When the connection is next reused by a completely independant Weblogic thread is there any chance that the non-default setting could be inherited by the new thread?
I realize that there is a conceptual difference between a process, a connection, and a session so theoretically the answer to my question should be "no."