Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unable to insert values thru SQL driver

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

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question