Skip to content

run php from java

Is there a way to run php server**(remote)** scripts from a java program (with secured/encrypted connection). Answer Visit (make post or get HTTP request) php page from your java program, for example, via HttpUrlConnection type

PreparedStatement setNull(..)

Java PreparedStatement provides a possibility to explicitely set a Null value. This possibility is: Are the semantics of this call the same as when using a specific setType with a null parameter? ? Answer This guide says: 6.1.5 Sending JDBC NULL as an IN parameter The setNull method allows a programmer to sen…

How do I manually configure a DataSource in Java?

I’m trying to follow Sun’s JDBC tutorial at http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html It gives the following example code: This code doesn’t compile because the DataSource interface has none of these methods, except for the getConnection() method invoked last. (Here…

Reading a remote file using Java

I am looking for an easy way to get files that are situated on a remote server. For this I created a local ftp server on my Windows XP, and now I am trying to give my test applet the following address: and of course I receive the following error: URI scheme is not “file” I’ve been trying som…

How do I convert from int to Long in Java?

I keep finding both on here and Google people having troubles going from long to int and not the other way around. Yet I’m sure I’m not the only one that has run into this scenario before going from int to Long. The only other answers I’ve found were “Just set it as Long in the first p…

C# Java HashMap equivalent

Coming from a Java world into a C# one is there a HashMap equivalent? If not what would you recommend? Answer Dictionary is probably the closest. System.Collections.Generic.Dictionary implements the System.Collections.Generic.IDictionary interface (which is similar to Java’s Map interface). Some notable…

Java UTF-8 strange behaviour

I am trying to decode some UTF-8 strings in Java. These strings contain some combining unicode characters, such as CC 88 (combining diaresis). The character sequence seems ok, according to http://www.fileformat.info/info/unicode/char/0308/index.htm But the output after conversion to String is invalid. Any ide…