Found 4336 Articles for Java 8

What is the use of setFetchSize() and setMaxRows() methods of the JDBC Statement Interface?

Daniol Thomas
Updated on 30-Jul-2019 22:30:25

1K+ Views

The setFetchSize(int) method defines the number of rows that will be read from the database when the ResultSet needs more rows. setFetchSize(int) affects how the database returns the ResultSet data.Whereas, setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time. setMaxRows(int) affects the client side JDBC object.

How to use multiple resource bundle in same JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25

237 Views

The tag is used to load a resource bundle and stores it in the named scoped variable or the bundle configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultbasenameBase name of the resource bundle family to expose as a scoped or a configuration variableYesNonevarName of the variable to store the new bundleNoReplace defaultscopeScope of the variable to store the new bundleNoPageExample           JSTL fmt:setBundle Tag                     The above code will generate the following result −One Two Three

How to set locate to identify required resource bundle in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

143 Views

The tag is used to store the given locale in the locale configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueSpecifies a two-part code that represents the ISO-639 language code and an ISO-3166 country code.Yesen_USvariantBrowser-specific variantNoNonescopeScope of the locale configuration variableNoPageExampleResource bundles contain locale-specific objects. Resource bundles contain key/value pairs. When your program needs a locale-specific resource, you keep all the keys common to all the locale but you can have translated values specific to locale. Resource bundles helps in providing content specific to locale.A Java resource bundle file contains a series of key-to-string mappings. The method that we ... Read More

What is the difference between the methods setBlob() and setBinaryStream() which is preferable in JDBC?

Nancy Den
Updated on 30-Jul-2019 22:30:25

696 Views

The setBlob() method is used to set value for Blob datatype in the database. It has three variants as follows:void setBlob(int parameterIndex, Blob x): Sets the given Blob value to the parameter at the specified index.void setBlob(int parameterIndex, InputStream inputStream): Sets the contents of the given input stream as a value to the parameter at the specified index.void setBlob(int parameterIndex, InputStream inputStream, long length): Sets the contents of the given input stream as a value to the parameter at the specified index.The setBinaryStream() method is used to set the contents of the given InputStream as a value for the parameter ... Read More

How to use resource bundle in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25

1K+ Views

The tag will make the specified bundle available to all tags that occur between the bounding and tags. With this, you need not specify the resource bundle for each of your tags.For example, the following two blocks will produce the same output − AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultbasenameSpecifies the base name of the resource bundle that is to be loaded.YesNonePrefixValue to prepend to each key name in subtagsNoNoneExampleResource bundles contain locale-specific objects. Resource bundles contain key/value pairs. When your program ... Read More

How to insert an image in to MySQL database using Java program?

Nancy Den
Updated on 31-Oct-2023 04:08:56

23K+ Views

To hold an image in MySQL database generally blob type is used. Therefore, make sure that you have a table created with a blob datatype with the following description:+-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | Name | varchar(255) | YES | | NULL | | | image | blob | YES | | NULL | | +-------+--------------+------+-----+---------+-------+To insert an image in to MySQL database, follow the steps given below:Step 1: Connect to the databaseYou can connect to a database using the getConnection() method of the DriverManager class.Connect to the MySQL database ... Read More

How to parse date in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

735 Views

The tag is used to parse dates.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueDate value to read (parse)NoBodytypeDATE, TIME, or BOTHNodatedateStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNoDefaulttimeStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNoDefaultparseLocaleLocale to use when parsing the dateNoDefault localepatternCustom parsing patternNoNonetimeZoneTime zone of the parsed dateNoDefault time zonevarName of the variable to store the parsed dateNoPrint to pagescopeScope of the variable to store the formatted dateNopageA pattern attribute is provided that works just like the pattern attribute for the tag. However, in the case of parsing, the pattern attribute tells the parser what format to expect.Example   ... Read More

How to format date in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25

4K+ Views

The tag is used to format dates in a variety of ways.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueDate value to displayYesNonetypeDATE, TIME, or BOTHNodatedateStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNodefaulttimeStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNodefaultpatternCustom formatting patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the formatted dateNoPrint to pagescopeScope of the variable to store the formatted dateNopageThe pattern attribute is used to specify even more precise handling of the date −CodePurposeSampleGThe era designatorADyThe year2002MThe monthApril & 04dThe day of the month20hThe hour(12-hour time)12HThe hour(24-hour time)0mThe minute45sThe second52SThe millisecond970EThe day of the weekTuesdayDThe day of ... Read More

How to insert an image in to Oracle database using Java program?

Nancy Den
Updated on 30-Jul-2019 22:30:25

5K+ Views

To hold an image in Oracle database generally blob type is used. Therefore, make sure that you have a table created with a blob datatype as:Name Null? Type ----------------------------------------- -------- ---------------------------- NAME VARCHAR2(255) IMAGE BLOBTo insert an image in to Oracle database, follow the steps given below:Step 1: Connect to the databaseYou can connect to a database using the getConnection() method of the DriverManager classConnect to the Oracle database by passing the Oracle URL which is jdbc:oracle:thin:@localhost:1521/xe (for express edition), username and password as parameters to the getConnection() method.String oracleUrl = "jdbc:oracle:thin:@localhost:1521/xe"; Connection con = DriverManager.getConnection(oracleUrl, "user_name", "password");Step 2: Create ... Read More

How to parse currencies in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

170 Views

The tag is used to parse numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to read (parse)NoBodytypeNUMBER, CURRENCY, or PERCENTNonumberparseLocaleLocale to use when parsing the numberNoDefault localeintegerOnlyWhether to parse to an integer (true) or floating-point number (false)NofalsepatternCustom parsing patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the parsed numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageA pattern attribute is provided that works just like the pattern attribute for the tag. However, in the case of parsing, the pattern attribute tells the parser what format to expect.Example ... Read More

Advertisements