I'm working in project, my theme is to develop an application management system for fingerprint and RFID card attendance machine in java programming language.
My problem i didn't find documentation in java for connecting with this device.
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?
My application with Oracle Database only works with Ethernet, I tried to connect via wireless without any response. When I run the command netstat the port state is WAIT TIME and then be closing. The clients machines run Windows 7 and 8 and the server run Suse Linux Enterprise Server 10 SP2, if the client machine run XP all works fine. I disabled the firewalls in the both sides.
I have downloaded jns-1.7 & tried to run an example program "Simulator.java" by specifing the jar classpath while compiling as "javac -cp <path-to-jns-jar-file> Simulator.java". But i got 21 errors as follows:
Simulator.java:3: error: package jns.command does not exist import jns.command.Command; ^ Simulator.java:4: error: package jns.element does not exist import jns.element.Element;
[Code] ...
21 errors
I am trying my hand on JNS as i need to deveop a key-distribution scheme (random Key-Distribution scheme) using a simulator. As i have experience in java, i thought to use JNS instead of NS2/NS3 which seems very complex to me.
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?
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 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.
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
I am trying to use a custom listener to initialize database connection pool (C3P0) on start up and then destroy on context shut down. The reason for that is that I whenever context is shutdown I have a memory leak because initialized connection pool is not being destroyed.
I have a static class called C3P0Utils that deals with connection pool. In my listener in contextInitialized method I have tried at first to init the pool like this :
I know that object is created. I checked it using jconsole. However it is not accessible with in the application. My second attempt was to regester the pool and then add it to the context and then when I need it read from there.
I am using EJB (Stateless) without any web service. I simply need to send a String from Client to Server
I can connect any Java SE Client with this EJB. But how I can connect an Android Client with this EJB (i.e. Using EJBRemote Interface) directly? I am using :
I want to make a service like Spotify, where I can stream music that I have stored on my computer (in this case server) to my laptop or phone.
* What would be a suitable format for this? * How would I actually stream it? I want to stream, not download and then play, I want to play the music while downloading.
I have a program thats ran over a network and is multi-player. However whenever I fire any bullets they do not fire on the other clients screen. Here's the code
import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; import java.util.*; public class TankWar {
This question has confused me because "Errors" are capitalized and I'm not sure what they mean.
To me this question is false. Sockets can be used to transfers file over a network.
I can't see why this wouldn't work. The code looks fine to me.
I don't think this is true unless you're using the mouseEntered() or mouseExited() method. But again, I'm not sure.
I think this is true, I don't know what else could have listeners.
They're only worth a few marks each so the answer is only suppose to be a line or two. They are all true or false questions that require an explanation.
I am trying to develop an application which will be showing a TimeSeries graph(related library JFreeChart) displaying network activity related to a particular network interface embedded in a JFrame.I have created a JPopUpMenu which is having containing a list of JMenuItems showing network interfaces as their String values.Menu is popping up correctly
Further I am selecting a JMenuItem related to a particular network interface to show network activity in TimeSeries graph.On selecting a JMenuItem I can see that graph is moving on constantly but not able to see any network activity.
Further I can see that packetArrived method of PacketListener is not being overridden by class PacketHandler as I am not able to see data packets on console and static list in main class is also empty.
If you have final int i = 1; short s = 1; switch(s) { case i: System.out.println(i); }
it runs fine. Note that the switch expression is of type short (2 bytes) and the case constant is of type int (4 bytes).My question is: Is the type irrelevant as long as the value is within the boundaries of the type of the switch expression?I have the feeling that this is true since:
byte b = 127; final int i = 127; switch(b) { case i: System.out.println(i); }
This runs fine again, but if I change the literal assigned to i to 128, which is out of range for type byte, then the compiler complains.Is it true that in the first example the short variable and in the second example the byte variable (the switch expressions) are first implicitly converted to an int and then compared with the case constants?
Got a problem with generics, which I'm still pretty new at. Here's a program that compiles fine:
import java.util.ArrayList; import javax.swing.JComponent; public class Experiments { public static void main(String[] args) { ListHolder holder = new ListHolder();
[Code] ....
It's useless, but it compiles. If I change Line 14, however, to add a generic type parameter to the ListHolder class, Line 10 no longer compiles:
import java.util.ArrayList; import javax.swing.JComponent; public class Experiments { public static void main(String[] args) { ListHolder holder = new ListHolder();
[Code] ....
I get this error:
Uncompilable source code - incompatible types: java.lang.Object cannot be converted to javax.swing.JComponent at experiments.Experiments.main(Experiments.java:10)
Apparently, the introduction of the type parameter leaves the compiler thinking that aList is of type Object. I can cast it, like this:
JComponent c = ((ArrayList<JComponent>)holder.aList).iterator().next();
That makes the compiler happy, but why is it necessary? How does adding the (unused) type parameter to the ListHolder class end up making the compiler think the aList member of an instance of ListHolder is of type Object?
Suppose you are given a computer with 1GB RAM. The disk of this computer holds a 10GB file containing random numbers. Propose a technique for sorting the file without using the disk or network or virtual memory. Outline your approach, propose an algorithm, and implement the algorithm. What is the algorithmic complexity of your algorithm.