How to store a varying length string in the database
Hi,
what is the best way to store a string (which can be infinitely long) in the database?
there's limitation on varchar2...can i use blobs/clobs ??
Thanks in advance for any enlightenment!
null
Is this a JDBC question?
Meta data solutions mean that you will only find problems at runtime that would be obvious at compile time with a non-metadata solution. Code generation makes production of large numbers of these easy.
But if you want metadata then you create a seperate class in a seperate package which holds the constants. The specifics depend on the implementation but you will typically have one class for each 'type' that is supported.
That package is used by both the server and the client code.
You can of course put other common functionality in the package (like a wrappers for the collections themselves, validation of names, etc.)
Similar Messages
-
How to store images along with text in the database ------its urgent
i'm developing an application which will be similar to to the page which we use for posting the forum. if in a text field we enter some text and an image how does we store the whole the information in database which in the textarea (both the text entered and the image) and how it can be extracted as if the user entered
Hi,
Refer thsi link, this may help you
http://www.sap-basis-abap.com/saphr003.htm
Call the FM BDS_BUSINESSDOCUMENT_CREATEF to upload the images from System.
codeLOGICAL_SYSTEM
CLASSNAME PICTURES
CLASSTYPE OT
CLIENT 321
OBJECT_KEY ZIMAGE [/code]
and the table parameter Files pass
code DOC_COUNT 00000001
COMP_COUNT 00000001
COMP_ID
DIRECTORY C:\
FILENAME WINTER.JPG
MIMETYPE
[/code]
now check it.
here you can upload multiple images inside a loop call the FM.
Regards,
Shiva. -
How To Store pdf or doc file in Oracle Database using Java Jdbc?
can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.
Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
for Adding PDF in DB i used image.jsp
Database table structure (table name. pictures )
Name Null? Type
ID NOT NULL NUMBER(11)
IMAGE BLOB
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file =
new File("D:/info.pdf");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
if(i!=0){
out.println("<h2>PDF inserted successfully");
else{
out.println("<h2>Problem in image insertion");
catch(Exception e){
out.println("<h2>Failed Due To "+e);
%>
O/P: PDF inserted successfully
i tried to display that pdf using servlet. i am giving the code below.
import java.io.IOException;
import java.sql.*;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DispPDF extends HttpServlet {
* The doGet method of the servlet. <br>
* This method is called when a form has its tag value method equals to get.
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setContentType("text/html"); i commented. coz we cant use response two times.
//PrintWriter out = response.getWriter();
try{
InputStream sPdf;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
ResultSet rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
//out.println(bytearray);
int size=0;
sPdf = rs.getBinaryStream(1);
response.reset();
response.setContentType("application/pdf");
while((size=sPdf.read(bytearray))!= -1 ){
//out.println(size);
response.getOutputStream().write(bytearray,0,size);
catch(Exception e){
System.out.println("Failed Due To "+e);
//out.println("<h2>Failed Due To "+e);
//out.close();
OP
PDF-1.4 %âãÏÓ 2 0 obj <>stream x+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
plz help me out. -
How to search a string from the database?
how to search a string from the database? starting with some character
If you're trying to do this in a SELECT, you can use the LIKE verb in your WHERE clause.
Here's an Example
SELECT obj_name FROM tadir
INTO prog
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name LIKE 'Z%'.
In this case it will select every row that obj_name starts with Z.
If you wanted to find every row that the field obj_name contains say... 'WIN' you use LIKE '%WIN%'.
Edited by: Paul Chapman on Apr 22, 2008 12:32 PM -
How to find when index was created in the database.
Hi,
Please help me, how to find when index was created in the database. It should give with date and time.
Thanks... BakserPlease help me, how to find when index was created in the database. It should give with date and time.DBA_/ALL/User_objects Created
Name Null? Type
OWNER VARCHAR2(30)
OBJECT_NAME VARCHAR2(128)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED DATE
LAST_DDL_TIME DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
select OBJECT_NAME,TIMESTAMP,CREATED from ALL_OBJECTS where OWNER='OWNERNAME' AND OBJECT_NAME='OBJECT_NAME' AND OBJECT_TYPE='INDEX';Edited by: Anantha on Apr 21, 2009 3:18 PM
Edited by: Anantha on Apr 21, 2009 3:19 PM -
How to deal with time zone while upgrading the database?
Hi,
How to deal with time zone while upgrading the database?
Thanks
Edited by: user12135020 on Jul 4, 2011 3:06 AMHello,
I answered to a Wrong post.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Jul 4, 2011 12:15 PM -
How to store entire files in a oracle 7 database
How can i store entire files for example image files in a oracle 7 databese. Does is support LOB??
How can i store entire files for example image files in a oracle 7 databese. Does is support LOB??Hi there,
to be short: yes you can.
I actually did it myself, but there a several problems to tacle first:
- Use LONG RAW as datatyp
- you can have only one column in a table with LONG RAW
- consider the overall amount of space used in the database
- adjust the size of the rollbacksegments.
Have fun
Rolf -
How to store records that are entered in the fields?
Hi friends can any one help me how to store the records that are given as input.
Say if Empid - 123456, this 123456 has to be stored in table it will be stored but can any one help me with procedure?
ThanksHi,
If the records are from an input file, you will have to first create a structure for the Employee id ....
then, read the input file data into the internal table you have defined in the earlier step...
then, loop at the records one after the other and update the records directly into the table....( typically this is a direct update of data and will be done when you were dealing with the data relating to a "Z" table )
please follow the procedure and let me know how it worked for you or if you are still having issues on this.
Thanks,
Vishnu. -
How can I add my Host String in the Registry?
Hi everybody,
I know there's a way to add the Host String in the Registry, but I don't remember how to do it? Can anyone please help me. I want to do this because every time I log in I just want to type the username and password and not the Host String because is a little bit long for me and the users when they open a form to type data.
Help me please!Dear User,
Instead of Using Registery Side ,
you should use log-on trigger. This is form level trigger.
logon('username','passard@hoststring').
if would go for registry then You have change in registry for each user while the above solution does not need
such changes.
Thanks and Regards
Manish Tiwari -
Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
shapes in Excel Object.
Since the Excel.Application
is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
interact with Excel document.
The figure below is an excel file:
Figure 1.
You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
$text = “text1”,”text2”,”text3”,”text3”
$Excel
= New-Object -ComObject Excel.Application
$Excel.visible = $true
$Workbook
= $Excel.workbooks.open("d:\shape.xlsx")
#Open the excel file
$Worksheet
= $Workbook.Worksheets.Item("shapes")
#Open the worksheet named "shapes"
$shape = $Worksheet.Shapes
# Get all the shapes
$i=0
# This number is used to replace the text in sequence as the variable “$text”
Foreach ($sh in $shape){
$sh.TextFrame.Characters().text
# Get the textbox in the shape
$sh.TextFrame.Characters().text =
$text[$i++]
#Change the value of the textbox in the shape one by one
$WorkBook.Save()
#Save workbook in excel
$WorkBook.Close()
#Close workbook in excel
[void]$excel.quit()
#Quit Excel
Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
Besides, we can also find the documents about these methods and properties in MSDN:
Workbook.Worksheets Property (Excel):
http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
Worksheet.Shapes Property:
http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
Shape.TextFrame Property:
http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
TextFrame.Characters Method (Excel):
http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
Characters.Text Property (Excel):
http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
After running the script above, we can see the changes in the figure below:
Figure 2.
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thank you for the information, but does this thread really need to be stuck to the top of the forum?
If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
EDIT: I see this is no longer stuck to the top of the forum, thank you.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
How do I search for a string in the Text tab of the Layers panel
I have a world map with a text layer for country names. I hide the country names as needed by clicking on the 'eye' icon for Toggle Visibility in the Layers panel. I've inadvertently hidden one name and I need to know how to find it in the Text panel so I can make it visible again. How do I seatrch for a name in the Text panel?
Just in case there is an unlocked and visible object close to the hidden one in the stacking order, you may select that object right on the artboard and then go to the Layers palette menu and take the Locate Object command.
Of course, this would be just one possible workaround to locate the hidden objects a bit easier. -
How to get Chinese string in the database?
Hi,
My dear friends.
I successfully connect the database, the data in the table as shown below
When I try to get "小明", but the following results were obtained
Does anyone know why, and how to get the correct result?
Thank you.You need to be aware of character conversions. Look at WideString, it support UTF32 chars.
-
STORE A COMPLETE FILE SYSTEM IN THE DATABASE 11GR2
Hi everyone
I have the following issue:
I tried to store in an oracle database TABLE the completre file structure
of a file system that includes the follwing:
-Name of the file
-Date of last modification
-Location
-The entire content of the phisical file BLOB datatype
I have the following piece of code to archieve this, but i still have a
problem...
When i tried to add the records to the database by implememting all
the connecttions stuffs, oracle and java classes required the program
inserts a FEW RECORDS and after that:
¡¡¡hangs up!!!.
The main problem is that i cant release the connection and get another new when i using
JDBC POOL so the server full their available connections.
Please tell me what is the best approach or programming practice on order to
meet this goal.
Thanks from Colombia - Latin America..
HERE IS THE CODE:
import java.io.* ;
* A simple class to demonstrate a recursive directory traversal
* in Java.
* Error handling was left out to make the code easier to understand.
* In production code, you should check if the arguments from the
* command line are really file files or directories.
public class RecursiveTraversal
* Works on a single file system entry and
* calls itself recursively if it turns out
* to be a directory.
* @param file A file or a directory to process
public void traverse( File file )
// Print the name of the entry
//System.out.println( file ) ;
// Check if it is a directory
if( file.isDirectory() )
// Get a list of all the entries in the directory
String entries[] = file.list() ;
// Ensure that the list is not null
if( entries != null )
// Loop over all the entries
for( String entry : entries )
// Recursive call to traverse
traverse( new File(file,entry) ) ;
else
if(file.isFile())
System.out.println( file.getParent() ) ;
System.out.println( file.getName() ) ;
else
System.out.println("*** WRONG VALUE ***");
* The program starts here.
* @param args The arguments from the command line
public static void main( String args[] )
// Create an object of this class
RecursiveTraversal rt = new RecursiveTraversal() ;
if( args.length == 0 )
// If there are no arguments, traverse the current directory
rt.traverse( new File(".") ) ;
else
// Else process every argument sequentially
for( String arg : args )
rt.traverse( new File(arg) ) ;
}Thanks for the reply, the implementation that you refer is useful for another type of application i need to stored the file system in a TABLE of a database
in order to make a part of an information system integration and can use SQL statements to acomplish this.
I follow the recomendation and post it in the SQL/JDBC forum because when i try to release de active connection i can't acomplish this.
And i need to know how to use JDBC connection poolling to open a connection just once, release and use it again. -
How to capture user name and date in the database
How to capture the person name who edits the application and the date of edit in the database...
PallaviHi
There are substitution strings you can use for this purpose.
1.APP_USER ------is the current user running the application
2.SYSDATE --------represents the current date on the database server
APP_USER Syntax
Bind variable------ :APP_USER
PL/SQL------- V('APP_USER')
Substitution string---------- &APP_USER.
SYSDATE_YYYYMMDD Syntax
Bind variable------- :SYSDATE_YYYYMMDD
Direct PL/SQL------- APEX_APPLICATION.G_SYSDATE (DATE DATATYPE)
PL/SQL-------- V('SYSDATE_YYYYMMDD')
Your application will be based on a table with primary key column. You create a 'before update trigger' on that table and add columns 'UPDATED_ON' and 'UPDATED_BY' to that table. Add the following to that trigger:
:NEW.UPDATED_ON := SYSDATE;
SELECT V('APP_USER') INTO :NEW.UPDATED_BY FROM DUAL;
-Priyanka -
How to view tables in another schema in the database
I am starting to use the SQl Developer 1.5.
We can connect to an oracle database successfully, expanding the tables, it shows the list of tables of one schema.
We have other schema in the database. In the query panel, when we type in the name of the other schema such as tcs. then some table names will popup in the intellisense.
How can we show the list tables in other schema within the same database.In SQL Developer left panel, there's a browse tree. There's a 'Other Users' branch under each database, expand that you will see all the option to check user's objects. Your user need to have check dictionary privilege
Maybe you are looking for
-
Voltar padrão de Fábrica e Usar o Itunes do computador.
Olá! Meu iphone é o 3gs, comprei usado, e não consigo resetar, voltar ao padrão de fábrica, eu baixei o Itunes no meu computador mas ele não reconhece meu celular pelo USB, já reiniciei a maquina e o celular...e nada... como eu faço para voltar ao pa
-
Adobe Media Encoder CC auf Mac nicht vorhanden?
Hallo! Ich habe ein Problem und zwar, mir fehlt der Adobe Media Encoder auf meinem Mac. Ich wollte geschnittene Videos in einer Warteschlange rendern, doch dann musste ich feststellen das ich dieses Programm nicht installiert habe. Muss ich es irgend
-
Adding Metadata deletes keywords in Bridge 2.1.1.9
I had keyworded a large number of images. I then noticed that I had not applied my usual Metadata info (IPTC Core) (copyright, name, address, etc). I went to the Metadata panel, selected and clicked to Append my 2008 Metadata to the large number of s
-
Problem while running OVS(Object value Selector)
Hi, I am getting a Nullpointer exception at <b>WDValueServices.addOVSExtension</b>("Flight Selection", ovsStartUpAttributes, wdThis.wdGetOVSTestCompController().getOVSInputNode(), wdThis.wdGetOVSTestCompController().get
-
Can't get my AGP G4 into Target Mode
I have a new Intel MacMini I want to use for my home computer, so I tried get my old G4 to startup in Target mode (using lower case "t" at startup) to make file backup and account setup easier. The G4 will not go into Target mode - I've tried both re