Results 1 to 4 of 4
Thread: problem in sql connectivity
- 03-26-2010, 03:57 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 5
- Rep Power
- 0
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
- 03-26-2010, 05:55 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
A Depends on the "DB". Ask the DB vendor what the settings are for the ODBC DataSource.
- 03-26-2010, 06:14 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 5
- Rep Power
- 0
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:
- 03-26-2010, 06:50 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Similar Threads
-
connectivity problem - oracle10g XE with Java on Vista Home Premium 64 bit
By venkateshcoolmoon in forum JDBCReplies: 5Last Post: 01-28-2010, 12:34 PM -
sql connectivity
By prashant in forum JDBCReplies: 2Last Post: 12-27-2008, 04:05 AM -
database connectivity
By vani in forum EclipseReplies: 0Last Post: 11-21-2008, 10:03 AM -
Connectivity Test
By jimhaddon in forum Java AppletsReplies: 9Last Post: 08-16-2008, 04:40 PM -
ensure connectivity
By perdoname in forum JDBCReplies: 1Last Post: 04-22-2008, 02:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks