Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using java.sql in my own class  RSS feed

 
Lucas Mach
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lucas Mach
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doh! can't believe i forgot that! thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!