How to get JDBC Driver Major/Minor Version in Java?

How to get JDBC Driver Major/Minor Version in Java?
DeeKay May 2, 2011 at 2:29 pm · java.sql

Below code shows, how to get the Major and Minor version of JDBC driver in Java –


How to get all Loaded JDBC Driver List in Java?

How to get all Loaded JDBC Driver List in Java?
DeeKay May 2, 2011 at 2:17 am · java.sql

Below Code shows, how to get all loaded JDBC Driver list in java code –


How to get JDBC Driver Version in Java?

How to get JDBC Driver Version in Java?
DeeKay May 2, 2011 at 1:56 am · java.sql

Below Java code shows, how to get JDBC Driver Version –


How to get JDBC Driver Name in Java?

How to get JDBC Driver Name in Java?
DeeKay April 30, 2011 at 10:46 pm · java.sql

Below code show how to get Driver name in java –


How to Enable JDBC Logging in Java Code?

How to Enable JDBC Logging in Java Code?
DeeKay April 29, 2011 at 9:38 pm · java.sql

Below java code shows, how to enable JDBC logging in the code –


How to get JDBC Connection to ORACLE Database in Java?

How to get JDBC Connection to ORACLE Database in Java?
DeeKay April 29, 2011 at 8:51 pm · java.sql

Below code snippet shows you to get the JDBC connection in java for ORACLE DB. To get the JDBC connection you will need JDBC Driver Jar for ORACLE Database.


How to get JDBC Connection to MYSQL Database in Java?

How to get JDBC Connection to MYSQL Database in Java?
DeeKay April 29, 2011 at 6:26 pm · java.sql

Below code snippet shows you to get the JDBC connection in java for MYSQL DB. To get the JDBC connection you will need JDBC Driver Jar for MYSQL Database.


How to get JDBC Connection to HSQL Database in Java?

How to get JDBC Connection to HSQL Database in Java?
DeeKay April 29, 2011 at 6:06 pm · java.sql

Below code snippet shows you to get the JDBC connection in java. To get the JDBC connection you will need JDBC Driver Jar for HSQLDB.


How to get JDBC Driver Property Info in Java?

How to get JDBC Driver Property Info in Java?
DeeKay April 29, 2011 at 5:42 pm · java.sql

Below java code shows you JDBC driver property information – /**************************************************************************************** * Created on 04-2011 Copyright(c) http://kodehelp.com All Rights Reserved. ****************************************************************************************/ package com.kodehelp.javasql; import java.sql.Driver; import java.sql.DriverManager; import java.sql.DriverPropertyInfo; import java.util.Properties; /** * Created by http://kodehelp.com * Date: 4/29/11 */ public class GetDriverPropertyInfo { public static void main(String args[]) throws Exception{ Class.forName(“oracle.jdbc.driver.OracleDriver”); Properties info =…
Continue Reading »


How To Convert String To InputStream in Java?

How To Convert String To InputStream in Java?
DeeKay April 29, 2011 at 2:28 am · java.io

Below Java code show how to convert String to InputStream using ByteArrayInputStream class – /********************************************************************************** * Created on 04-2011 Copyright(c) http://kodehelp.com All Rights Reserved. **********************************************************************************/ package com.kodehelp.javaio; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; /** * Created by http://kodehelp.com * Date: 4/28/11 */ public class StringToInputStream { public static void main(String[] args){ String text = “Converting…
Continue Reading »


How To Read Text File in Java?

How To Read Text File in Java?
DeeKay April 29, 2011 at 1:58 am · java.io

Below code example shows how to read the text file in java. First the file is read into inputstream. /********************************************************************************** * Created on 04-2011 Copyright(c) http://kodehelp.com All Rights Reserved. **********************************************************************************/ package com.kodehelp.javaio; import java.io.*; /** * Created by http://kodehelp.com * Date: 4/28/11 */ public class ReadTextFile { public static void main(String[] args) throws Exception{ InputStream…
Continue Reading »


How To Convert InputStream to String in Java

How To Convert InputStream to String in Java
DeeKay April 29, 2011 at 12:55 am · java.io

Below Java code show how to read the file in InputStream and convert the inputStream to String. In this example the file used (“TEST.txt”) is kept in the root directory of your project. /********************************************************************************** * Created on 04-2011 Copyright(c) http://kodehelp.com All Rights Reserved. **********************************************************************************/ package com.kodehelp.javaio; import java.io.*; /** * Created by http://kodehelp.com * Date:…
Continue Reading »


How To Get Extension of a File in Java?

How To Get Extension of a File in Java?
DeeKay April 29, 2011 at 12:23 am · java.io

Below Java code example show how to retrieve the extension of File using Java File object – /********************************************************************************** * Created on 04-2011 Copyright(c) http://kodehelp.com All Rights Reserved. **********************************************************************************/ package com.kodehelp.javaio; import java.io.File; /** * Created by http://kodehelp.com * Date: 4/28/11 */ public class ExtensionOfFile { public static final String DOT_SEPARATOR = “.”; public static void…
Continue Reading »


Java Code Example for Applet: getDocumentBase() Method

Java Code Example for Applet: getDocumentBase() Method
DeeKay April 19, 2011 at 5:38 pm · java.applet

getDocumentBase() emthod of Applet class returns the URL of the document in which this applet is embedded. For example, suppose an applet is contained within the document: C:/Vigilance/samples/bin/index.html Then the document base is : C:/Vigilance/samples/bin/index.html Below java code show how to get the document base in Applet : /********************************************************************************** * Created on Nov, 2004 Copyright(c)…
Continue Reading »


Java Code Example for Java Applet

Java Code Example for Java Applet
DeeKay April 19, 2011 at 4:13 pm · java.applet

An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application. The Applet class must be the superclass of any applet that is to be embedded in a Web page or viewed by the Java Applet Viewer. The Applet class provides a…
Continue Reading »


Java Code Example for BufferedReader to read Character InputStream

Java Code Example for BufferedReader to read Character InputStream
DeeKay April 18, 2011 at 11:53 pm · java.io

BufferedReader class of Java API provides a way to read the character inputstream, by buffering the characters which provides an efficient way to read the characters, arrays and lines. The buffer size may be specified, or the default size may be used. The default is large enough for most purposes. In general, each read request…
Continue Reading »


Java Code Example for BufferedOutputStream : flush() Method

Java Code Example for BufferedOutputStream : flush() Method
DeeKay April 18, 2011 at 8:59 pm · java.io

flush() method of BufferedOutStream flushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream. Overrides: flush in class FilterOutputStream Throws: IOException – if an I/O error occurs. Below code example show how the output stream is flushed and writes out the output stream. /********************************************************************************** *…
Continue Reading »


Java Code Example for BufferedOutputStream : write(byte[]b, int off, int len) Method

Java Code Example for BufferedOutputStream : write(byte[]b, int off, int len) Method
DeeKay April 18, 2011 at 8:37 pm · java.io

BufferedOutputStream’s write(byte[]b,int off,int len) method writes len bytes from specified array of byte starting from offset off to the outputstream. This method stores bytes from the given array into this stream’s buffer, flushing the buffer to the underlying output stream as needed. If the requested length is at least as large as this stream’s buffer,…
Continue Reading »


Java Code Example for BufferedOutputStream : write(int b) Method

Java Code Example for BufferedOutputStream : write(int b) Method
DeeKay April 18, 2011 at 8:23 pm · java.io

BufferedOutputStream’s write(int b) method overrides write(int b) method of FilterOutputStream. This method writes the specified byte to this output stream. The write method of FilterOutputStream calls the write method of its underlying output stream, that is, it performs out.write(b). Implements the abstract write method of OutputStream. Parameters: b – the byte. Throws: IOException – if…
Continue Reading »


Java Code Example for BufferedOutputStream to Write OutputStream

Java Code Example for BufferedOutputStream to Write OutputStream
DeeKay March 30, 2011 at 12:55 am · java.io

BufferedOutputStream can be setup to write the bytes to the underlying output stream without necessarily causing call to the underlying system for each byte written. BufferedOutputStream class has below two constructor : BufferedOutputStream(OutputStream out) – Creates a new buffered output stream to write data to the specified underlying output stream. BufferedOutputStream(OutputStream out, int size) –…
Continue Reading »