JDBC Tutorials

1. TEXT datatype SPLIT in MSSQL - to solve the 8000 limit set by varchar

By: Dave : 2010-04-06

Description: I have been frustrated with the 8000 limit set by the varchar data type in MSSQL. For procedures that required text length more than 8000 character limit, MSSQL offers the TEXT datatype. However there are not as many functions that are supported for TEXT datatype. For example if you would like to split the data string which is seperated by a delimitter, then it is not easy to split the text.

2. Import TEXT to TABLE in MSSQL

By: Fernando : 2010-04-06

Description: Use this code to import value in text into a table in MSSQL

3. What is Referential Integrity in databases?

By: Peter den Haan : 2008-12-27

Description: What happens when you start manipulating the records in your tables? You can edit the book information at will without any ill effects, but what would happen if you needed to delete a title? The entries in the Contribution table will still link to a nonexistent book. Clearly you can't have a contribution detail without the associated book title being present. So, you must have a means in place to enforce a corresponding book title for each contribution. This is the basis of enforcing referential integrity. You can enforce the validity of the data in this situation in two ways. One is by cascading deletions through the related tables; the other is by preventing deletions when related records exist.

4. Handling CSV in Stored Procedures

By: Balmer : 2008-08-05

Description: You have a number of key values in CSV format(comma separated values), identifying a couple of rows in a table, and you want to retrieve these rows. If you are the sort of person who composes your SQL statements in client code, you might have something that looks like this:

5. setSavepoint and releaseSavepoint Example in Java

By: Vimala : 2007-10-13

Description: The JDBC 3.0 API adds the method Connection.setSavepoint, which sets a savepoint within the current transaction. The Connection.rollback method has been overloaded to take a savepoint argument.

6. Calling a Stored Procedure from JDBC in Java

By: Watson : 2007-10-13

Description: JDBC allows you to call a database stored procedure from an application written in the Java programming language. The first step is to create a CallableStatement object. As with Statement and PreparedStatement objects, this is done with an open Connection object. A callableStatement object contains a call to a stored procedure; it does not contain the stored procedure itself. The first line of code below creates a call to the stored procedure SHOW_SUPPLIERS using the connection con. The part that is enclosed in curly braces is the escape syntax for stored procedures. When the driver encounters "{call SHOW_SUPPLIERS}", it will translate this escape syntax into the native SQL used by the database to call the stored procedure named SHOW_SUPPLIERS.

7. java.lang.NoClassDefFoundError and java.lang.NoSuchMethodError

By: Yolander : 2007-10-13

Description: One of the places java tries to find your .class file is your current directory. So if your .class file is in C:\java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:

8. Creating Database Connection Pool in Tomcat 5.0 and Tomcat 5.5 for MySQL and Java

By: Emiley J : 2007-10-12

Description: This tutorial gives you a close look at Jakarta Commons Database Connection Pool (DBCP) in Tomcat 5.0 and Tomcat 5.5. DBCP is the database connection pooling technology built into the popular open-source Tomcat servlet engine. Because it’s included with Tomcat, you don’t need to download or install any files or libraries.

9. JDBC Basics and JDBC Components

By: Henry : 2007-10-12

Description: This short code fragment instantiates a DriverManager object to connect to a database driver and log into the database, instantiates a Statement object that carries your SQL language query to the database; instantiates a ResultSet object that retrieves the results of your query, and executes a simple while loop, which retrieves and displays those results. It's that simple.

10. SELECT Statements

By: Ivan Lim : 2007-10-12

Description: A SELECT statement, also called a query, is used to get information from a table. It specifies one or more column headings, one or more tables from which to select, and some criteria for selection. The RDBMS returns rows of the column entries that satisfy the stated requirements. A SELECT statement such as the following will fetch the first and last names of employees who have company cars: