db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sieg <siegfr...@heintze.com>
Subject Wanted: Example using SQLXML
Date Tue, 17 Jul 2007 15:59:23 GMT

I found the following example below and saw the example work at our JUG
meeting. However, I cannot make it work. I get an exception "feature not
supported" when  createSQLXML.

I'm using derby 10.2.2.0. Some of the other JDBC examples work indicating I
have derby set up correctly.

Siegfried


package jdbcDemo.DJUG.Sharad.Acharya;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.sql.Statement;

import org.apache.derby.jdbc.EmbeddedDataSource40;
// this does not work for me!
public class Example3 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Connection con = null;
		Statement stmt = null;
		EmbeddedDataSource40 ds = null;
		String dbName = "example1_1";
		String tableName = "student1";
		ds = new EmbeddedDataSource40();
		ds.setDatabaseName(dbName);

		try {
			con = ds.getConnection();
			stmt = con.createStatement();
			SQLXML sx= con.createSQLXML();
			sx.setString("Math is Fun");
			String psx ="insert into "+tableName+
				" ( id, reading) values(?,?) ";
			PreparedStatement pstmt = con.prepareStatement(psx);
			pstmt.setString(1,"1000");
			pstmt.setSQLXML(2,sx);
			pstmt.executeUpdate();
		}catch(SQLException se){
			se.printStackTrace();
		}
		finally{
			try {
				stmt.close();
				con.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}			
		}
	}
}


-- 
View this message in context: http://www.nabble.com/Wanted%3A-Example-using-SQLXML-tf4097765.html#a11652372
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message