¶ÔoracleÖеÄBLOBµÄ²Ù×÷(¶ÁÈ¡£¬Ð´Èë)
½«BLOB±£´æÎª±¾µØÎĵµ£º
/// <summary>
/// ¶Á³öBlob×Ö¶Î
/// </summary>
/// <param name="commandText">sqlÓï¾ä£¬Ö´Ðнá¹ûΪBLOBÊý¾Ý</param>
/// <param name="DocumentAddress">½«Òª°ÑBLOBÊý¾Ý±£´æÎªµÄÎĵµµÄ·¾¶</param>
public void ReadBlob(string commandText, string DocumentAddress)
{
try
{
Open();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = commandText;
// ÀûÓÃÊÂÎñ´¦Àí£¨±ØÐ룩
OracleTransaction transaction = cmd.Connection.BeginTransaction();
cmd.Transaction = transaction;
reader = cmd.ExecuteReader();
reader.Read();
OracleLob BLOB = reader.GetOracleLob(0);
reader.Close();
FileStream DataStream = new FileStream(DocumentAddress, FileMode.Create);
int length = 30485760;
byte[] Buffer = new byte[length];
int i;
while ((i = BLOB.Read(Buffer, 0, length)) > 0)
{
DataStream.Write(Buffer, 0, i);
}
DataStream.Close();
BLOB.Clone();
cmd.Transaction.Commit();
}
catch (OracleException e)
{
cmd.Transaction.Rollback();
throw e;
}
finally
{
Close();
}
}
½«±¾µØÎĵµ±£´æÎªBLOBÀàÐÍ£º
/// <summary>
/// дÈëBlob×Ö¶Î
/// </summary>
/// <param name="commandText">sqlÓï¾ä£¬Ö´Ðнá¹ûΪBLOBÊý¾Ý</param>
/// <param name="DocumentAddress">±¾µØÎĵµµÄ·¾¶</param>
public void WriteBlob(string commandText, string DocumentAddress
Ïà¹ØÎĵµ£º
Oracle 11gµÄLinux°æ±¾ÔÚÐÞ¸ÄÁËMEMORY_TARGET»òÕßSGA_TARGETºóÆô¶¯¿ÉÄܻᱨ´í£º
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
Õâ¸öÎÊÌâÊÇÓÉÓÚÉèÖÃSGAµÄ´óС³¬¹ýÁ˲Ù×÷Ï ......
ǰÑÔ
ÿһ¸öDBAÔÚ½øÐÐÊý¾Ý¿â¹ÜÀíµÄ¹ý³ÌÖв»¿É±ÜÃâµÄÒªÓöµ½ÐÎÐÎɫɫµÄ´íÎó(ORA-1547 ,ORA-904,ORA-1578 ......)¡£ÓÐЩ´íÎóÓÉÓÚÆµ·±³öÏÖ¡¢ÔÒò¸´ÔÓ¶ø±» Oracle DBA ÃÇÏ·³ÆÖ®Îª"¾µäµÄ´íÎó"¡£ÆäÖÐORA-3113 "end of file on communication channel" ¾ÍÊÇÕâÑùµÄÒ»¸ö¡£
ÎÒÃÇ¿ÉÒÔ¼òµ¥µÄ°ÑÕâ¸ö´íÎóÀí½âΪOracle¿Í»§¶Ë½ø³ÌºÍÊý¾Ý¿ ......
Step 1: log on admin portal
Step 2: select menu 'Services' - 'JDBC' - 'Data Source' and click New button to create a new data source
Step 3 : specify jndi name ad database
Step 4 : click Next button to set transaction properties
Step 5 : define connection properties
Step 6 : test databa ......
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂËûÃǵ͍Ò壺
A schema is a collection of database objects (used by a user.).
Schema objects are the logical structures that directly refer to the database’s data.
A user is a name defined in the database that can connect to and access objects.
Schemas and users help database ......
²½Ö裺
1.Ê×ÏÈ£¬ÄãÒªÓÐÒ»ÕÅ±í£¡
CREATE TABLE example(
ID Number(4) NOT NULL PRIMARY KEY,
NAME VARCHA ......