Professional Documents
Culture Documents
However I found
that there was not a single place that gave a complete example to use
Derby to store and retrieve XML Data Type - Derby in Server Mode of
Operation.
So I thought I would post the code that got me going successfully - for
the benefit of someone else, provided Google gets to this posting!
grant {
permission java.util.PropertyPermission "user.home", "read";
permission java.util.PropertyPermission "java.home", "read";
permission java.lang.RuntimePermission "createClassLoader";
permission java.util.PropertyPermission "derby.*", "read";
permission java.io.FilePermission "C:\Program Files\Sun\JavaDB\*",
"read,write,delete";
permission java.lang.RuntimePermission "createClassLoader";
permission java.util.PropertyPermission "derby.*", "read";
// The next two properties are used to determine if the VM is 32 or 64
bit.
permission java.util.PropertyPermission "sun.arch.data.model", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "derby.storage.jvmInstanceId",
"write";
permission java.io.FilePermission "C:\Program
Files\Sun\JavaDB","read";
permission java.io.FilePermission "C:\Program Files\Sun\JavaDB\*",
"read,write,delete";
permission java.io.FilePermission "<>", "read,write,delete";
permission java.net.SocketPermission "*", "accept";
};
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
code:
package jdb.main;
import jdb.dao.ProcessSqlRequest;
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
package jdb.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
package jdb.dao;
import java.sql.Connection;
import java.sql.DriverManager;
@@@@@@@@@@@@@@@@@@@@@@@@@@@
run:
Sql Connection Successful
Inserted 1...Rows
Sql Connection Successful
Ahh.....done
DATA is ::: 7 ::: Your XML
DATA is ::: 8 ::: Your XML
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
I am using NetBeans 6.5.1 and Java DB 10.5.3.0 and the above worked
successfully.
Derby requires that a JAXP parser, such as Apache Xerces, and that
Apache Xalan are listed in the Java classpath for the XML functions to
work. If either the JAXP parser or Xalan is missing from the classpath,
attempts to use the XMLSERIALIZE operator will result in an error
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Let me know if this was useful and helped you in your mission of
seeing Java DB working for XML Data Type
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Happy Derbyyyying !
Ganesh Babu N R