cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointerException when connects from Webdynpro-iView to SQL server

Former Member
0 Kudos

Hi

'm trying to create a small webdynpro(using SAP netweaver studio) application that connects to SQL Server database.

This connection is through a JDBC connection.

and i wrote the code in the implementation of an iView.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection cn=DriverManager.getConnection("jdbc:odbc:lms","sa","sa");

But a null pointer exception comes on 2nd statement-in connection statement.

But it works correctly in a java class created in webdynpro itself.

Then i tried to call that java class method , from my iView implemntation code.

But still null pointer exception ...

i hope this will be answered by any of you.

thanks

Smitha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

try this

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

Connection conn= java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://<DBServerIP>:<Port>;user=<UserName>;password=<password>;database=<DBNAME>");

see the Thread

Kind Regards

Mukesh

Former Member
0 Kudos

hI SIR,

I tried with you code..

But in the first line itself ..

java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

is coming..

and inside the connection statement , how to find the port no:?

expecting yur reply

thanks

smitha

Former Member
0 Kudos

Hi,

For the first you should include mssqldriver.jar,msutil.jar,msbase.jar

Regards

Saravanan K

Former Member
0 Kudos

Hi

You have to import the jar files

The port for MSSQL is 1433

You have to add the jar files in to your J2EE server by deploying it as library project.

See the help

http://help.sap.com/saphelp_nw2004s/helpdata/en/82/fdbf2085f65f43a71e755fc904478d/frameset.htm

See the Thread for library project

Kind Regards

Mukesh

Former Member
0 Kudos

Thanks for ur valuable suggestions..

From where can i find mssqldriver.jar,msutil.jar,msbase.jar?

i searched the MS SQL server installed directories..i couldn't find..

expecting ur reply

thanks

smitha

Former Member
0 Kudos

Hi

You can Install the Microsoft SQL Server 2000 Driver for JDBC from net.

or send your mail id i will send it

Kind Regards

Mukesh

Former Member
0 Kudos

Thank you sir ,

i'll try from net..

my id:smith_snair@rediffmail.com

thanks

smitha

Former Member
0 Kudos

sir,

I got connection using SQL server.

Thanks for your help.

regards Smitha

Answers (0)