Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 15th, 2003, 12:22 PM
drDigital drDigital is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 drDigital User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
JDBC / MySQL

Here is my Java code:
Code:
import java.io.*;
import java.sql.*;
import java.util.*;

public class MySQL {
	public static void main(String[] args) {

 		// The call to Class.forName explicitly loads the driver class
        Class.forName("org.gjt.mm.mysql.Driver");
        // the following url says that the protocol is jdbc, the 
        // subprotocol is mysql, and our database (thebookdemo) is installed on the machine 
        // anvil
        String url = "jdbc:mysql://dnetv/darrendn";

        // the method DriverManager.getConnection is the only method that a 
        // general programmer needs to use directly. This method establishes a 
        // connection to a database specified by a URL, loginID and password.
        Connection con = DriverManager.getConnection(url, "root", "rajanator");

        // Once a connection has been established we can create an instance 
        // of Statement, through which we will send queries to the database.
        Statement stmt = con.createStatement();
  
        // The method executeQuery executes a query on the database. The 
        // return result is of type ResultSet which is one or more rows in 
        // this case.
        ResultSet rs = stmt.executeQuery("SELECT name FROM graffiti_wall");

	}
}


even with simple code i get lots of errors! when I run it.
Code:
Exeption in thread "main" java.lang.Error: Unresolved compilation problem: out cannot be resolved

at sun.reflect.NativeConstructorAccessorImple.newInstance0(Native Method)

at sun.rat sun.reflect.NativeConstructorAccessorImple.newInstance(NativeConstrucotrImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance0(DelegatingConstructorAccessorImpl.java:27  )
at java.lang.reflect.COnstructor.inewInstance(Constructor.java:274)
at MySQL.main(MySQL.java:35)


Does anyone have any idea what this cryptic error msg means?

I do PHP and MySQL development, so this java stuff is quite new to me.

Thanks in advance.

Reply With Quote
  #2  
Old February 16th, 2003, 04:08 PM
halimanh halimanh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 6 halimanh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
the error refer to line 35 of MySql.java. but your source code is less than 35 lines...post more...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > JDBC / MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT