Problems with importing java.sql.*

Hi.
When I'm compiling the following code I get this message:
SimpeltDatabaseEksempel.java:4: Package java.sql not found in import import java.sql.*
What could be wrong?
/lars
Here is my code:
import java.sql.*;
public class SimpeltDatabaseeksempel
     public static void main(String[] arg) throws Exception
          // Udskift med din egen databasedriver og -URL
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          Connection forb = DriverManager.getConnection("jdbc:odbc:datakilde1");
          Statement stmt = forb.createStatement();
          stmt.executeUpdate("create table KUNDER (NAVN varchar(32), KREDIT float)" );
          stmt.executeUpdate("insert into KUNDER values('Jacob', -1799)");
          stmt.executeUpdate("insert into KUNDER values('Brian', 0)");
}

Don't know what to tell you, except that it exists
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/package-summary.html
What version of java are you using?

Similar Messages

  • Problems with impoting java.sql.*

    Hi.
    When I'm compiling the following code I get this message:
    SimpeltDatabaseEksempel.java:4: Package java.sql not found in import import java.sql.*
    What could be wrong?
    /lars
    Here is my code:
    import java.sql.*;
    public class SimpeltDatabaseeksempel
         public static void main(String[] arg) throws Exception
              // Udskift med din egen databasedriver og -URL
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection forb = DriverManager.getConnection("jdbc:odbc:datakilde1");
              Statement stmt = forb.createStatement();
              stmt.executeUpdate("create table KUNDER (NAVN varchar(32), KREDIT float)" );
              stmt.executeUpdate("insert into KUNDER values('Jacob', -1799)");
              stmt.executeUpdate("insert into KUNDER values('Brian', 0)");
    }

    There is no problem in your classpath but make sure that your classpath is set correctly.
    set classpath=%classpath%;C:\j2sdk1.4.2_04\lib
    or got to Environment variables and then edit the classpath vartiable and add the C:\j2sdk1.4.2_04\lib path (Respective to your system).

  • A problem with importing java.util.concurrent

    I am rather new to Java with not that much experience. I apologize ahead though if this is the inappropriate forum to post this problem and/or this question has been answered somewhere else (I couldn't find a post on this subject).
    Some of my research has lead to using a semaphore if you wish to use the synchronized() method. I looked up that the import for that is under java.util.concurrent.Semaphore; however, thanks to netbeans for pointing this out before I compiled it, this doesn't seem to exist.
    I'm using Java version 1.6.0_03 which does seem to be the latest version. Was it simply removed or am I seriously missing something big here? Anyways, I'm at a total loss and hopefully someone can point me in the right direction.
    Thank you in advance for your help.

    jiju wrote:
    check whether import java.util.concurrent.*; is workingAwesome.
    As for netbeans, I went and double checked to see if it is reading from the most updated folder of Java and it is.
    So as I said, I am totally lost as to why it's not working. Should I just downgrade to a lower version of Java? Although it would seem kinda weird to do something like this.

  • Connection error using import java.sql.*;

    I have a very strange error. See the code below:
    import java.sql.*;
    import java.lang.*;
    class a7 {
    public static void main(String args[]) {
    String kolom,ko = new String();
    String db = "devarbn1";
    String url = "jdbc:odbc:"+db;
    String login = "arbor";
    String password = "arbor123";
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String BasisQuery = "select COLUMN_NAME " +
    " from all_tab_columns " +
    " where table_name = ? ";
    System.out.println("Database: " + db);
    Connection con;
    try { 
    Class.forName(driver);
    } catch (java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con = DriverManager.getConnection(url,login,password); //this line gives an error!!!
    and so on.....
    This is a fragment of the whole program. All of a sudden I cannot compile it anymore using jdk1.3 or jdk 1.4 (I never had compiling problems before with this program)
    It gives the following error message: incompatible types, found Connection.
    I haven't got a clue what went wrong. I have a lot of other java files in which a connection is involved. I cannot compile any of them anymore. Even reinstalling jdk1.4 or 1.3 doesn't help. Can anyone please help me?
    Thanx, debeumers

    Yes, the whole message is:
    incompatible types found : java.sql.Connection required : Connection.
    The whole code is (it is from a different java file then the code I used before)
    import javax.sql.*;
    import java.sql.*;
    import java.lang.*;
    public class Connection {
    static final String arb_nl = "arbornl";
    static final String arb_fr = "arborfr";
    static final String clar_nl = "clarnl";
    static final String clar_fr = "clarfr";
    static final String po = "pcnlpp";
    static final String user_clar_nl = "report";
    static final String pass_clar_nl = " r3p0rt";
    static final String user_clar_fr = "report";
    static final String pass_clar_fr = " r3p0rt";
    static final String user_arb_fr = "report";
    static final String pass_arb_fr = " r3p0rt";
    static final String user_arb_nl = "report";
    static final String pass_arb_nl = " r3p0rt";
    static final String user_po_nl = "report";
    static final String pass_po_nl = "r3p0rt";
    static boolean a = true;
    static boolean b = true;
    static boolean c = true;
    static Connection conarb,conclar,conpo;
    static String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String loginarb = user_arb_nl;
    String passwordarb = pass_arb_nl;
    String loginclar = user_clar_nl;
    String loginpo = user_po_nl;
    String passwordpo = pass_po_nl;
    String passwordclar = pass_clar_nl;
    public Connection() {
    public void makeConnection(String database,String user,String password,String type) {
    String url = "jdbc:odbc:" + database;
    try { 
    Class.forName(driver);
    } catch (java.lang.ClassNotFoundException ex) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(ex.getMessage());
    a = false;
    try { if (type=="ARB")  { conarb = DriverManager.getConnection(url,user,password);} //giving the problem!!
    if (type=="CLAR") { conclar = DriverManager.getConnection(url,user,password);} //giving the problem!!
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    b = false;
    /* try { if (type=="PO") {conpo = DriverManager.getConnection(url,user,password);}
    } catch(SQLException ex) {System.err.println("SQLException: " + ex.getMessage()); c = false;}*/
    I hope you can help..
    Thanks...debeumers

  • Problems with backing Java Code

    Earlier I manually deleted the processChange event handler method for a textfield from the backing java code. As I had no plans to use that event handler. Now my page abends with a message stating that the process chnage method is not available. I tried to add via the event handler for the textbox using the GUI but it does not add the process change event handler method. Using an another process change method as a model I manually entered the code to handle process change for the text bos. Now I am getting an internal server exception - Null in one of the parameters. PLEASE HELP. What are my options - Delete and re-create the entire page

    Hi,
    Yes I am using the recommeded code: The Text field generating the null exception is addDataSourceTF. Whenever we click on the addDataSourceBTN we get an Internal exception.
    Thanks very much for looking into this problem. Any advice will be greatly appreciated.
    <h:panelGrid binding="#{MainPage.gridPanel1}" cellpadding="3" cellspacing="2" columnClasses="" id="gridPanel1" style="background-color: rgb(204, 255, 204); left: 48px; top: 312px; position: absolute">
    <h:inputText binding="#{MainPage.addDataSourceTF}" id="addDataSourceTF" style="font-family: Arial,Helvetica,sans-serif"
    validator="#{MainPage.addDataSourceTF_validate}" valueChangeListener="#{MainPage.addDataSourceTF_processValueChange}"/>
    <h:commandButton action="#{MainPage.addDataSourceBTN_action}" binding="#{MainPage.addDataSourceBTN}" id="addDataSourceBTN"
    image="resources/button32.jpg" value="Add Data Source"/>
    <h:selectOneMenu binding="#{MainPage.deleteDataSourceDD}" id="deleteDataSourceDD" immediate="true" onchange="this.form.submit();"
    style="height: 23px; width: 164px" valueChangeListener="#{MainPage.deleteDataSourceDD_processValueChange}">
    <f:selectItems binding="#{MainPage.dropdown1SelectItems}" id="dropdown1SelectItems" value="#{MainPage.database_infoRowSet.selectItems['DB_SRC,DB_SRC']}"/>
    </h:selectOneMenu>
    <h:commandButton action="#{MainPage.deleteDataSourceBTN_action}" binding="#{MainPage.deleteDataSourceBTN}" id="deleteDataSourceBTN"
    image="resources/delete.jpg" value="Submit"/>
    </h:panelGrid>
    Backing Java Code:
    * MainPage.java
    * Created on December 15, 2004, 1:45 AM
    * Copyright adear1
    package dissertation;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import javax.faces.event.*;
    import com.sun.sql.rowset.*;
    import javax.faces.context.FacesContext;
    import javax.faces.application.FacesMessage;
    import javax.faces.convert.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    import java.lang.*;
    import javax.faces.context.*;
    public class MainPage extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
    private int __placeholder;
    private HtmlForm form1 = new HtmlForm();
    public HtmlForm getForm1() {
    return form1;
    public void setForm1(HtmlForm hf) {
    this.form1 = hf;
    private HtmlCommandButton addDataSourceBTN = new HtmlCommandButton();
    public HtmlCommandButton getAddDataSourceBTN() {
    return addDataSourceBTN;
    public void setAddDataSourceBTN(HtmlCommandButton hcb) {
    this.addDataSourceBTN = hcb;
    private HtmlCommandButton searchDataBTN = new HtmlCommandButton();
    public HtmlCommandButton getSearchDataBTN() {
    return searchDataBTN;
    public void setSearchDataBTN(HtmlCommandButton hcb) {
    this.searchDataBTN = hcb;
    private HtmlCommandButton scrubbingRulesBTN = new HtmlCommandButton();
    public HtmlCommandButton getScrubbingRulesBTN() {
    return scrubbingRulesBTN;
    public void setScrubbingRulesBTN(HtmlCommandButton hcb) {
    this.scrubbingRulesBTN = hcb;
    private HtmlCommandButton scrubDataSourceBTN = new HtmlCommandButton();
    public HtmlCommandButton getScrubDataSourceBTN() {
    return scrubDataSourceBTN;
    public void setScrubDataSourceBTN(HtmlCommandButton hcb) {
    this.scrubDataSourceBTN = hcb;
    private HtmlCommandButton uploadDataSourceBTN = new HtmlCommandButton();
    public HtmlCommandButton getUploadDataSourceBTN() {
    return uploadDataSourceBTN;
    public void setUploadDataSourceBTN(HtmlCommandButton hcb) {
    this.uploadDataSourceBTN = hcb;
    private HtmlCommandButton deleteDataSourceBTN = new HtmlCommandButton();
    public HtmlCommandButton getDeleteDataSourceBTN() {
    return deleteDataSourceBTN;
    public void setDeleteDataSourceBTN(HtmlCommandButton hcb) {
    this.deleteDataSourceBTN = hcb;
    private HtmlInputText addDataSourceTF = new HtmlInputText();
    public HtmlInputText getAddDataSourceTF() {
    return addDataSourceTF;
    public void setAddDataSourceTF(HtmlInputText hit) {
    this.addDataSourceTF = hit;
    private HtmlSelectOneMenu deleteDataSourceDD = new HtmlSelectOneMenu();
    public HtmlSelectOneMenu getDeleteDataSourceDD() {
    return deleteDataSourceDD;
    public void setDeleteDataSourceDD(HtmlSelectOneMenu hsom) {
    this.deleteDataSourceDD = hsom;
    private DefaultSelectItemsArray dropdown1DefaultItems = new DefaultSelectItemsArray();
    public DefaultSelectItemsArray getDropdown1DefaultItems() {
    return dropdown1DefaultItems;
    public void setDropdown1DefaultItems(DefaultSelectItemsArray dsia) {
    this.dropdown1DefaultItems = dsia;
    private UISelectItems dropdown1SelectItems = new UISelectItems();
    public UISelectItems getDropdown1SelectItems() {
    return dropdown1SelectItems;
    public void setDropdown1SelectItems(UISelectItems uisi) {
    this.dropdown1SelectItems = uisi;
    private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();
    public HtmlPanelGrid getGridPanel1() {
    return gridPanel1;
    public void setGridPanel1(HtmlPanelGrid hpg) {
    this.gridPanel1 = hpg;
    private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid();
    public HtmlPanelGrid getGridPanel2() {
    return gridPanel2;
    public void setGridPanel2(HtmlPanelGrid hpg) {
    this.gridPanel2 = hpg;
    private HtmlOutputText welcomeOT = new HtmlOutputText();
    public HtmlOutputText getWelcomeOT() {
    return welcomeOT;
    public void setWelcomeOT(HtmlOutputText hot) {
    this.welcomeOT = hot;
    private JdbcRowSetXImpl database_infoRowSet = new JdbcRowSetXImpl();
    public JdbcRowSetXImpl getDatabase_infoRowSet() {
    return database_infoRowSet;
    public void setDatabase_infoRowSet(JdbcRowSetXImpl jrsxi) {
    this.database_infoRowSet = jrsxi;
    private DefaultSelectItemsArray listbox1DefaultItems1 = new DefaultSelectItemsArray();
    public DefaultSelectItemsArray getListbox1DefaultItems1() {
    return listbox1DefaultItems1;
    public void setListbox1DefaultItems1(DefaultSelectItemsArray dsia) {
    this.listbox1DefaultItems1 = dsia;
    private HtmlSelectOneListbox dataSourceLB = new HtmlSelectOneListbox();
    public HtmlSelectOneListbox getDataSourceLB() {
    return dataSourceLB;
    public void setDataSourceLB(HtmlSelectOneListbox hsol) {
    this.dataSourceLB = hsol;
    private DefaultSelectItemsArray listbox1DefaultItems2 = new DefaultSelectItemsArray();
    public DefaultSelectItemsArray getListbox1DefaultItems2() {
    return listbox1DefaultItems2;
    public void setListbox1DefaultItems2(DefaultSelectItemsArray dsia) {
    this.listbox1DefaultItems2 = dsia;
    private UISelectItems listbox1SelectItems = new UISelectItems();
    public UISelectItems getListbox1SelectItems() {
    return listbox1SelectItems;
    public void setListbox1SelectItems(UISelectItems uisi) {
    this.listbox1SelectItems = uisi;
    private JdbcRowSetXImpl database_infoRowSet1 = new JdbcRowSetXImpl();
    public JdbcRowSetXImpl getDatabase_infoRowSet1() {
    return database_infoRowSet1;
    public void setDatabase_infoRowSet1(JdbcRowSetXImpl jrsxi) {
    this.database_infoRowSet1 = jrsxi;
    private JdbcRowSetXImpl user_tableRowSet = new JdbcRowSetXImpl();
    public JdbcRowSetXImpl getUser_tableRowSet() {
    return user_tableRowSet;
    public void setUser_tableRowSet(JdbcRowSetXImpl jrsxi) {
    this.user_tableRowSet = jrsxi;
    private HtmlMessages messageList1 = new HtmlMessages();
    public HtmlMessages getMessageList1() {
    return messageList1;
    public void setMessageList1(HtmlMessages hm) {
    this.messageList1 = hm;
    private HtmlOutputText welcomeOT1 = new HtmlOutputText();
    public HtmlOutputText getWelcomeOT1() {
    return welcomeOT1;
    public void setWelcomeOT1(HtmlOutputText hot) {
    this.welcomeOT1 = hot;
    // </editor-fold>
    public MainPage() {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    try {
    database_infoRowSet.setDataSourceName("java:comp/env/jdbc/mySQL");
    database_infoRowSet.setCommand("SELECT ALL database_info.DB_SRC, database_info.USER_ID FROM database_info WHERE database_info.USER_ID = ?");
    database_infoRowSet1.setDataSourceName("java:comp/env/jdbc/mySQL");
    database_infoRowSet1.setCommand("SELECT ALL database_info.DB_SRC, database_info.DB_URL, database_info.DB_SCHEMA, database_info.DB_TYPE, database_info.USER_ID FROM database_info WHERE database_info.USER_ID = ?");
    user_tableRowSet.setDataSourceName("java:comp/env/jdbc/mySQL");
    user_tableRowSet.setCommand("SELECT * FROM user_table");
    } catch (Exception e) {
    log("MainPage Initialization Failure", e);
    throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
    // </editor-fold>
    // Additional user provided initialization code
    try{
    database_infoRowSet.setString(1, getSessionBean1().getSbUserID());
    database_infoRowSet1.setString(1, getSessionBean1().getSbUserID());
    database_infoRowSet.execute();
    database_infoRowSet1.execute();
    database_infoRowSet1.first();
    if (database_infoRowSet.next()) {
    // If no row found then make the following button's as readonly
    database_infoRowSet.first();
    else {
    FacesContext fc =
    javax.faces.context.FacesContext.getCurrentInstance();
    fc.addMessage(null, new FacesMessage(
    "Please Add Data Source to Begin Processing", ""));
    searchDataBTN.setDisabled(true);
    scrubbingRulesBTN.setDisabled(true);
    scrubDataSourceBTN.setDisabled(true);
    uploadDataSourceBTN.setDisabled(true);
    catch (Exception ex){
    log("Error in initializing database_info Row Set", ex);
    protected dissertation.ApplicationBean1 getApplicationBean1() {
    return (dissertation.ApplicationBean1)getBean("ApplicationBean1");
    protected dissertation.SessionBean1 getSessionBean1() {
    return (dissertation.SessionBean1)getBean("SessionBean1");
    * Bean cleanup.
    protected void afterRenderResponse() {
    user_tableRowSet.close();
    database_infoRowSet1.close();
    database_infoRowSet.close();
    public String searchDataBTN_action() {
    // TODO Following code was replaced by static navigation
    // TODO Replace with your code
    //if no value selected then we prompt them to select a row
    if (dataSourceLB.getValue().equals("")||dataSourceLB.getValue()== null){
    // return error msg to select a row before continuing
    FacesContext fc =
    javax.faces.context.FacesContext.getCurrentInstance();
    fc.addMessage(null, new FacesMessage("Please select a data source to process", ""));
    return null;
    else {
    // call method to retrieve the db_schema from the
    getDbDetails();
    getDbDriver();
    return "searchcriticaldata";
    public String scrubbingRulesBTN_action() {
    // TODO Replace with your code
    if (dataSourceLB.getValue().equals("")||dataSourceLB.getValue()== null){
    // return error msg to select a row before continuing
    FacesContext fc =
    javax.faces.context.FacesContext.getCurrentInstance();
    fc.addMessage(null, new FacesMessage("Please select a data source to process", ""));
    return null;
    else {
    // call method to retrieve the db_schema from the
    getDbDetails();
    getDbDriver();
    return "definecolumnrules";
    public String scrubDataSourceBTN_action() {
    // TODO Replace with your code
    if (dataSourceLB.getValue().equals("")||dataSourceLB.getValue()== null){
    // return error msg to select a row before continuing
    FacesContext fc =
    javax.faces.context.FacesContext.getCurrentInstance();
    fc.addMessage(null, new FacesMessage("Please select a data source to process", ""));
    return null;
    else {
    // call method to retrieve the db_schema from the
    getDbDetails();
    getDbDriver();
    return "scrubdata";
    public String uploadDataSourceBTN_action() {
    // TODO Replace with your code
    if (dataSourceLB.getValue().equals("")||dataSourceLB.getValue()== null){
    // return error msg to select a row before continuing
    FacesContext fc =
    javax.faces.context.FacesContext.getCurrentInstance();
    fc.addMessage(null, new FacesMessage("Please select a data source to process", ""));
    return null;
    else {
    // call method to retrieve the db_schema from the
    getDbDetails();
    getDbDriver();
    return "uploaddata";
    public String addDataSourceBTN_action() {
    // TODO Following code was replaced by static navigation
    if ( false) {
    // TODO Replace with your code
    if (addDataSourceTF.getValue().equals("")){
    FacesContext fc =
    javax.faces.context.FacesContext.getCurrentInstance();
    fc.addMessage(null, new FacesMessage(
    "Please specify Data Source to Add", ""));
    return null;
    else {
    String woSpaces = ((String)addDataSourceTF.getValue()).replace(' ', '_');
    getSessionBean1().setSbDataSrc(woSpaces);
    return "adddatasrc";
    return "adddatasrc";
    public void getDbDetails(){
    try {
    Context ctx = new InitialContext();
    if (ctx == null) throw new NamingException("No Initial Context");
    DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mySQL");
    if (ds == null) throw new NamingException("No Data Source mySQL");
    Connection conn = ds.getConnection();
    if (conn == null)
    throw new SQLException("Unable to establish connection");
    String sql = "Select db_src, db_url, db_schema, db_type user_id, src_password from database_info where db_src=?";
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, (String) dataSourceLB.getValue());
    ResultSet rs = pstmt.executeQuery();
    if (rs.next()){
    getSessionBean1().setSbDataSrc(rs.getString("db_src"));
    getSessionBean1().setSbDb_Schema(rs.getString("db_schema"));
    getSessionBean1().setSbDb_Type(rs.getString("db_type"));
    getSessionBean1().setSbDb_Userid(rs.getString("user_id"));
    getSessionBean1().setSbDb_Password(rs.getString("src_password"));
    else
    java.lang.System.out.println("DB_Schema not found for db_src " +
    (String) dataSourceLB.getValue());
    rs.close();
    pstmt.close();
    conn.close();
    catch (SQLException ex) {
    java.lang.System.out.println("\n ----- SQL Exception caught ------\n");
    while (ex !=null){
    java.lang.System.out.println("Message: " + ex.getMessage());
    java.lang.System.out.println("SQLState: " + ex.getSQLState());
    java.lang.System.out.println("ErrorCode: " + ex.getErrorCode());
    ex = ex.getNextException();
    java.lang.System.out.println("");
    catch (NamingException e){
    java.lang.System.out.println("messge unable to establish context in changepassword.jsp");
    public void getDbDriver(){
    try {
    Context ctx = new InitialContext();
    if (ctx == null) throw new NamingException("No Initial Context");
    DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mySQL");
    if (ds == null) throw new NamingException("No Data Source mySQL");
    Connection conn = ds.getConnection();
    if (conn == null)
    throw new SQLException("Unable to establish connection");
    String sql = "Select db_driver from database_type where db_type=?";
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, getSessionBean1().getSbDb_Type());
    ResultSet rs = pstmt.executeQuery();
    if (rs.next()){
    getSessionBean1().setSbDb_Driver(rs.getString("db_driver"));
    else
    java.lang.System.out.println("DB_Driver not found for db_src " +
    (String) dataSourceLB.getValue());
    rs.close();
    pstmt.close();
    conn.close();
    catch (SQLException ex) {
    java.lang.System.out.println("\n ----- SQL Exception caught ------\n");
    while (ex !=null){
    java.lang.System.out.println("Message: " + ex.getMessage());
    java.lang.System.out.println("SQLState: " + ex.getSQLState());
    java.lang.System.out.println("ErrorCode: " + ex.getErrorCode());
    ex = ex.getNextException();
    java.lang.System.out.println("");
    catch (NamingException e){
    java.lang.System.out.println("messge unable to establish context in changepassword.jsp");
    public String deleteDataSourceBTN_action() {
    // TODO Replace with your code
    try {
    Context ctx = new InitialContext();
    if (ctx == null) throw new NamingException("No Initial Context");
    DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mySQL");
    if (ds == null) throw new NamingException("No Data Source mySQL");
    Connection conn = ds.getConnection();
    if (conn == null)
    throw new SQLException("Unable to establish connection");
    String sql = "Delete from database_info where db_src=?";
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, (String) deleteDataSourceDD.getValue());
    pstmt.executeUpdate();
    pstmt.close();
    conn.close();
    return "success";
    catch (SQLException ex) {
    java.lang.System.out.println("\n ----- SQL Exception caught ------\n");
    while (ex !=null){
    java.lang.System.out.println("Message: " + ex.getMessage());
    java.lang.System.out.println("SQLState: " + ex.getSQLState());
    java.lang.System.out.println("ErrorCode: " + ex.getErrorCode());
    ex = ex.getNextException();
    java.lang.System.out.println("");
    return "failure";
    catch (NamingException e){
    java.lang.System.out.println("messge unable to establish context in changepassword.jsp");
    return "failure";
    public void addDataSourceTF_processValueChange(ValueChangeEvent vce) {
    // TODO Replace with your code
    public void deleteDataSourceDD_processValueChange(ValueChangeEvent vce) {
    // TODO Replace with your code
    public void addDataSourceTF_validate(FacesContext fc, UIComponent uic, Object o) {
    // TODO Replace with your code
    }

  • Cannot import java.sql.BaseQuery

    Hi,
    I am trying to run the following example using JDK6:
    import java.sql.BaseQuery;
    import java.sql.DataSet;
    import java.sql.Select;
    public interface UserQueries extends BaseQuery {
        // Select all users
        @Select (sql ="SELECT userId, firstName, lastName FROM Users",
                 readOnly=false, connected=false, tableName="Users")
        DataSet<User> getAllUsers ();
        // Select user by name */
        @Select (sql ="SELECT userId, firstName, lastName FROM Users"
                 + "WHERE userName=?", readOnly=false, connected=false,
                 tableName ="Users")
        DataSet<User> getUserByName(String userName);
    }But I get the error in the import statement itlself. It is not able to import these classe-
    import java.sql.BaseQuery;
    import java.sql.DataSet;
    import java.sql.Select;
    Are they shipped with JDK 6?
    thnx
    Sanjeev.

    Because those classes don't exist. A simple, and very quick, perusal of the API docs would have told you this.
    http://java.sun.com/javase/6/docs/api/index.html

  • Import java.sql.*

    I am trying to create and application that connects to a database (MySQL) to do some queries. I put this
    import java.sql.*;
    at the top of my file and got this error message "package java.sql does not exist".
    Can anyone shed some light on this for me? :)

    My other guess is a typo, perhaps with an invisible/hard-to-see character. Delete the line and type it in, again.

  • Problem with "import sabasrv.database.*;"

    Hi there..
    I am new to the Java game so this is probably a very easy problem to fix.
    I am using the Forte IDE and My code has the following imports :
    package sabasrv.user;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.SQLException ;
    import sabasrv.database.*;
    The problem is that whenI try to compile I get the following error:
    src/sabasrv/user/User.java [8:1] Package sabasrv.database. not found in import.
    import sabasrv.database.*;
    ^
    src/sabasrv/user/User.java [16:1] Class DbSql not found in type declaration or import.
    DbSql sql ;
    ^
    2 errors
    Any ideas why I am getting this? My CLASSPATH environment variable is :
    CLASSPATH=C:\jdk1.1.8\jsdk23.jar;C:\old_Saba_servlet\src\sabasrv\database
    I hope this is enough info to go on.
    Your fwend.
    Korwin

    You classpath should probably be
    C:\old_Saba_servlet\src
    instead of
    C:\old_Saba_servlet\src\sabasrv\database
    if you have classfiles in that directory and not just the source files. Try that. The package name is "appended" to the classpath, so sabasrv.user will be /sabasrv/user when it looks for class files in that package.

  • Problem with connect to sql server ..

    I have problem with connect to sql server2005
    i use jpa(hibernate) and jsf
    javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    root cause
    javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
    org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1371)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:60)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    org.hibernate.exception.JDBCConnectionException: Could not open connection
    org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)
    org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1263)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:57)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost;databaseName=MIS
    java.sql.DriverManager.getConnection(Unknown Source)
    java.sql.DriverManager.getConnection(Unknown Source)
    org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:173)
    org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:276)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1263)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:57)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
    persistance.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="PrzychodnieLekarskiePU" transaction-type="RESOURCE_LOCAL">
    <class>model.Przychodznia</class>
    <properties>
    <property name="hibernate.connection.username" value="a"/>
    <property name="hibernate.connection.password" value="a"/>
    <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost;databaseName=MIS"/>
    <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
    <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost;databaseName=MIS"/>
    <property name="javax.persistence.jdbc.user" value="a"/>
    <property name="javax.persistence.jdbc.password" value="a"/>
    <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    </properties>
    </persistence-unit>
    </persistence>
    Edited by: 985713 on 2013-02-02 07:12
    Edited by: 985713 on 2013-02-02 07:37

    it works ok : I don't known where is error in jpa .. ?
    public class MyConnection {
         public static Connection getConnection () throws SQLException{
              String url = "jdbc:sqlserver://ABADDON1;databaseName=MIS";
              String user = "a";
              String pass = "a";
              DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
              Connection conn = DriverManager.getConnection(
                        url,user,pass);
              System.out.println("OK");;
              return conn;
    try {
                   conn = MyConnection.getConnection();
                   } catch (SQLException ex) {
                        System.out.println("Error: " + ex.getErrorCode()
                                  + ex.getMessage());
                   }

  • Problems with importing .dmp file (CLOB)

    dear all
    i am using oracle 10g XE
    I am facing a problem with importing dmp ( one of my table contains clob coloum)
    below mentioned is the error it gives while importing, please guide me as to how to handle this.
    Thanks in advance
    regards
    Uday
    "CREATE TABLE "RTEXT" ("SRNO" NUMBER, "TEXTDET" CLOB) PCTFREE 10 PCTUSED 40"
    " INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS "
    "1 BUFFER_POOL DEFAULT) TABLESPACE "APEX_1244730274482010" LOGGING NOCOMPRES"
    "S LOB ("TEXTDET") STORE AS (TABLESPACE "APEX_1244730274482010" ENABLE STOR"
    "AGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 "
    "FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))"
    IMP-00003: ORACLE error 959 encountered
    ORA-00959: tablespace 'APEX_1244730274482010' does not exist

    You have to use SELECT tablespace_name, status FROM dba_tablespaces; from sql prompt or sql developer.
    Ash
    As Jonathan Lewis mentions:
    A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
    If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
    It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful.

  • Problems with importing text messages from PC Suit...

    Problems with importing text messages from PC Suit 7.1.18.0 to my Nokia 5800
     I am trying to import a csv file that contains text messages (Note that this file was created using PC Suit 7.1.18.0) to a subfolder that I have created to My Folders but PC Suits only imports the text messages to the Draft folder. Note that initially it shows that the messages are import in the correct folder but after a refresh it shows them in the Draft Folder. Is their any setting that I should change in the PC Suit or the phone? My computer runs on Windows XP Service Pack 3 and the Nokia 5800 was upgraded to the latest firmware v20.0.012
     Thanks for your help

    Most phones only allows importing of draft and archived box for SMS.
    To do a restoring, you need to backup the SMS as a .nbu file using PC Suite and restore later.
    If you got an SD card, you can also do a backup on the SD Card (backup.arc) then restore later (reset and restore: backup.arc and mmc).
    What's the law of the jungle?

  • Tempo problems with imported wav files

    Hey everyone, sorry if there's a quick fix for this in the forums that I couldn't find, but I've been having some tempo problems with imported .wav files.
    Long story short, my system couldn't handle playing all the tracks for a song while recording drums, so I bounced out an mp3 of the song and put it in a new Logic file so my drummer could just play along to that as I recorded him. Unfortunately, the original song is at 167 bpm, but I forgot to change the bpm in the new Logic file with the .mp3 file of the song to 167 bpm, so it was left at the default 120 bpm.
    So, the drums were recorded at the correct 167 bpm, but Logic thinks that those new drum .wav files should be played at 120 bpm, so when I import my drum tracks back into the original file, they do not play correctly at all.
    I could get record it all again, but I wanted to check if there was a way I could salvage what I already have, since my drummer lives about an hour away right now and can't just come over whenever he wants.
    Thanks for the help! I really appreciate it.

    Hi,
    First, do not use MP3 in Logic, the sound quality is less than AIFF, WAV or CAF, and Logic has to decode it for playback, making it a heavier burden on the CPU than an uncoded audiofile, such as AIFF, WAV or CAF.
    Secondly, audio files are independent of Logic's tempo. If you bounce down an audio file in any format (other than Apple Loop), it will play back at the same speed, +regardless of Logics' tempo setting+, either at recording or playback. Logic doesn't 'think' anything. The BPM is only important to MIDI tracks, or to the spacing between audio files. The audio files themselves *are not affected* by the tempo setting. If you import an audio file of tempo 167 into a 120 BPM project, the file will still play at 167, only Logic will indicate the wrong bar positions.
    regards, Erik.

  • I have problem with login in sql Server give me support .pre login handshake

    I have problem with login in sql Server give me support .pre login handshake

    The following threads are on the same topic:
    http://www.sql-server-performance.com/forum/threads/pre-login-handshake-error-when-connecting-to-db.687/
    http://stackoverflow.com/questions/12308340/sql-server-2000-connection-error-pre-login-handshake
    http://dbaspot.com/sqlserver-server/458011-error-occurred-during-pre-login-handshake-microsoft-sql-server-error-10054-a.html
    Kalman Toth Database & OLAP Architect
    IPAD SELECT Query Video Tutorial 3.5 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Problems with IMPORT STATEMENT

    Please, can someone assist me? I am using Java Studio Enterprise 8.1 & Netbeans to design a java application and input form. But the wizard keeps on generating repeated class and subclasses even after I have used the import statement. Its making my program looks clumsy.
    I just want to use import statement once and start using the variable in the program without repeating the declaration.
    For instance, after importing javax.swing.*, I just want to be able to specify in my program (e.g JPanel Coylogo) without the wizard generating another private javax.swing.JPanel Coylogo.
    How can I do it. Please help. I will appreciate
    You look at the following section of the program to unstand what I mean. Thank you.
    import java.awt.HeadlessException;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.*;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import javax.swing.*;
    import java.sql.Date;
    * @author */
    public class inputForm extends JFrame
    private Connection con;
    private Statement stmt;
    private int k;
    ResultSet rs=null;
    // Variables declaration - do not modify
    private javax.swing.JLabel ClassLabel;
    private javax.swing.JPanel Connectivitypanel;
    private javax.swing.JPanel Coylogo;
    private javax.swing.JCheckBox DataCapable;
    private javax.swing.JLabel DateLabel;
    // End of variables declaration
    * Creates new form inputForm
    public inputForm()
    //con = new dbConnect();
    initComponents();
    con = dbconnection();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents()
    Coylogo = new javax.swing.JPanel();
    PhoneType = new javax.swing.JPanel();
    PhoneIdLabel = new javax.swing.JLabel();
    ClassLabel = new javax.swing.JLabel();
    phoneid = new javax.swing.JTextField();
    DateLabel = new javax.swing.JLabel();
    Connectivitypanel.setBorder(javax.swing.BorderFactory.createTitledBorder("CONNECTIVITY"));
    pbluetooth.setText("Bluetooth");
    pbluetooth.setActionCommand("bluetooth");
    pbluetooth.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    pbluetooth.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    pbluetooth.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
    pbluetooth.setMargin(new java.awt.Insets(0, 0, 0, 0));
    }// </editor-fold>
    private void allPhonesTypeActionPerformed(java.awt.event.ActionEvent evt)
    }

    disable add imports or organize imports in your IDE

  • Problem with import file type setting

    Problem with import file type settings - In preferences>general I select "wav encoder" But then going to tools>Create it still says "create mp3 version".
    Can't find a way to overcome this. Thanks for any help.

    Doublechecking, roy. After making the preferences change, are you leaving the General tab by clicking the OK button down the bottom-right-hand corner of the tab?

Maybe you are looking for