cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to insert values thru SQL driver

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

answered thanks