• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

using java.sql in my own class

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
doh! can't believe i forgot that! thanks!
 
My, my, aren't you a big fella. Here, have a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic