aspose file tools
The moose likes Beginning Java and the fly likes using java.sql in my own class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "using java.sql in my own class" Watch "using java.sql in my own class" New topic
Author

using java.sql in my own class

Lucas Mach
Greenhorn

Joined: Mar 31, 2005
Posts: 15
I'm writing a JSP page for a course and originally I had a bunch of code in my .jsp files, however, I'm trying to clean it up a bit by making use of Java classes. I made a package for my classes and wrote some functions in one of my classes. Originally, in the .jsp page i was doing: "include java.sql.*" to make use of the sql related functions. After moving all the code into my class I tried to compile the class and i get "cannot resolve symbol" errors for all the java.sql related stuff. Also, i tried to put "include java.sql*" at the top of my class like so:

but that doens't work either...what do i have to do to be able to access these java.sql functions in my class?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24050
    
  13

Hi Lucas,

In Java source files, you say "import" rather than "include".

import java.sql.*;

Furthermore, note that your "package" statement has to be the first statement in the file -- the imports have to come after it and before the definition of the class.


[Jess in Action][AskingGoodQuestions]
Lucas Mach
Greenhorn

Joined: Mar 31, 2005
Posts: 15
doh! can't believe i forgot that! thanks!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: using java.sql in my own class
 
Similar Threads
User defined class problem
Package not found error in JSP
Cannot compile servlet
Date conflict
Object "Savvy"