我正在尝试使用以下java程序创建插入BFILE数据类型值的示例。
public class ImportDriver
{
public static void main (String args [])
throws Exception
{
// Load the Oracle JDBC driver:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database:
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:@localhost:oracledb", "User1", "password");
conn.setAutoCommit (false);
Statement stmt = conn.createStatement ();
try
{
stmt.execute ("insert into test_dir_table values ('test', bfilename ('C:\\temp\\TEST_DIR', 'file1'))");
stmt.execute ("insert into test_dir_table values ('test2', bfilename ('C:\\temp\\TEST_DIR', 'file6'))");
stmt.execute ("insert into test_dir_table values ('test1', bfilename ('TEST_DIR', 'file2.gif'))");
// Commit the transaction:
conn.commit();
stmt.close();
conn.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
通过使用上面提到的程序值被插入到表中但是当我看到使用oracle开发工具的BFILE的值没有显示插入的图像时。
请建议如何使用java程序将BFILE值插入表中?