on 10-13-2008 11:28 AM
Hi , I am having problem regarding inserting the values in SQL server,but an exception is generated.i.e..SQLException.I hav mentioned below the code,plz look over it if there is any mistake as values not being to inserted thru url statement .
If any changes to be made plz mention it.
Try
{
mgr.reportWarning("starting.....");
mgr.raiseException("ur herer",false);
String drivername="com.sap.portal.jdbc.sqlserver.SQLServerDriver";
Class.forName(drivername);
mgr.reportWarning("Driver loaded");
mgr.raiseException("Driver loaded",false);
String url="jdbc:sap:sqlserver:// ... / *:*;DatabaseName=dbname";
conn=DriverManager.getConnection(url,"username","password");
mgr.reportSuccess("you r here");
Statement stmt=conn.createStatement();
String stmt1="insert into tablename(col)".concat("values('"wdContext.currentSurveyElement().getQuestion1()"')");
//PreparedStatement pstmt=conn.prepareStatement(stmt1);
ResultSet rs=stmt.executeQuery("insert into test""(Column1)" "values('wdContext.currentSurveyElement().getQuestion1()')");
stmt.close();
conn.close();
}
Regards:
hanif
HI,
use drivername:
com.microsoft.sqlserver.jdbc.SQLServerDriver
Connectiion object:
jdbc:sqlserver://<serverhost which has the sqldriver>
SQLEXPRESS:1433;database=<databaseName>;user=<usedname>;password=<password>
try with this details.
regards,
Kathiresan R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
answered thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.