Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 12th, 2010, 09:23 AM
Authorized User
Points: 359, Level: 6
Points: 359, Level: 6 Points: 359, Level: 6 Points: 359, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2006
Location: Belgrade, Serbia, Yugoslavia.
Posts: 73
Thanks: 11
Thanked 1 Time in 1 Post
Thumbs down Problem with Class.forName();

import java.sql.*;

publicclass JDBCConnectionExample {


* @param args


publicstaticvoid main(String[] args) {

// TODO Auto-generated method stub

// Create a variable for the connection string.

String connectionUrl = "jdbc:sqlserver://localhost:1433;" +

"databaseName=NovaBaza;integratedSecurity=false;us er=sa;password=javajdbc";

// Declare the JDBC objects.

Connection con = null;

Statement stmt = null;

ResultSet rs = null;

try {

// Establish the connection.


con = DriverManager.getConnection(connectionUrl);

// Create and execute an SQL statement that returns a

// set of data and then display it.

//String SQL = "SELECT * FROM BLOBTest;";

//stmt = con.createStatement();

//rs = stmt.executeQuery(SQL);

//displayRow("Ident", rs);


// Handle any errors that may have occurred.

catch (Exception e) {



finally {

if (rs != null) try { rs.close(); } catch(Exception e) {}

if (stmt != null) try { stmt.close(); } catch(Exception e) {}

if (con != null) try { con.close(); } catch(Exception e) {}


//private static void displayRow(String title, ResultSet rs) {

try {

/// System.out.println(title);

// while (rs.next()) {

// System.out.println(rs.getString());

// }

} catch (Exception e) {




java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at JDBCConnectionExample.main(JDBCConnectionExample.java:22)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
class problem beetle_jaipur CSS Cascading Style Sheets 2 March 5th, 2009 03:34 AM
Problem in Globals class pedroabs BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 8 June 12th, 2008 01:11 PM
Problem with class.......help Pettman ASP.NET 2.0 Basics 2 March 1st, 2006 03:51 PM
problem with using WebRequest class in C# anilkumarbv General .NET 0 December 28th, 2004 02:23 AM

All times are GMT -4. The time now is 10:58 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.