Results 1 to 4 of 4
  1. #1
    Bharati is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Talking problem in sql connectivity

    public void ToDatabase(){
    //Retrieve info from the textfields in the dialog
    String Name=Name1.getText();
    String SName=DomainName.getText();
    String Address=IPAddress.getText();
    String dbuser="";
    String dbpasswd="";
    String DriverPrefix="jdbc:odbc";
    String DataSource="UserInfo";

    //The SQL String

    String SQLString="INSERT INTO Users(username,domainname,ipaddress)VALUES('"+Name +'",'"+SName+"','"+Address+'")";

    //Loads JDBC/ODBC driver

    try{

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch(Exception e){
    JOptionPane.showMessageDialog(null,""+e.getMessage (),"JDBC Driver Error ",JOptionPane.WARNING_MESSAGE);
    return;
    }

    Statement stmt=null;
    Connection con=null;

    //Creates connection to the database
    try{
    con=DriverManager.getConnection(DriverPrefix+DataS ource,dbuser,dbpasswd);
    stmt=con.createStatement();
    }
    catch(Exception e)
    {

    JOptionPane.showMessageDialog(null,""+e.getMessage (),"Connection Error ",JOptionPane.WARNING_MESSAGE);
    }
    }

    Which SQL version we need to run this code as we are using jdk1.6.0_01 since their are some compatibility issues. Plz tell what settings do we need to configure in Control Panel.
    D

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    A Depends on the "DB". Ask the DB vendor what the settings are for the ODBC DataSource.

  3. #3
    Bharati is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default problem in sql connectivity

    Ok, But if i remove the constraint for jdk version then what will be your answer. Plz tell me the general procedure for database setting in Control Panel.:confused:

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Like I said, ask the DB vendor. It is not a Java related question.

Similar Threads

  1. Replies: 5
    Last Post: 01-28-2010, 12:34 PM
  2. sql connectivity
    By prashant in forum JDBC
    Replies: 2
    Last Post: 12-27-2008, 04:05 AM
  3. database connectivity
    By vani in forum Eclipse
    Replies: 0
    Last Post: 11-21-2008, 10:03 AM
  4. Connectivity Test
    By jimhaddon in forum Java Applets
    Replies: 9
    Last Post: 08-16-2008, 04:40 PM
  5. ensure connectivity
    By perdoname in forum JDBC
    Replies: 1
    Last Post: 04-22-2008, 02:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •