cancel
Showing results for 
Search instead for 
Did you mean: 

MSSQL DataBase Access -> Help me

Former Member
0 Kudos

Dear all ,

I did the necessary steps required for data base access in Visual Administrator(JDBC Connection)--> Both Driver and DataSource for MSSQL.

Created the Alias name .. Example -- MSSQL.

then ,, coded like this in portal application,

******************

InitialContext ctx = new InitialContext();

DataSource src = (DataSource) ctx.lookup("jdbc/MSSQL");

Connection con = src.getConnection();

***************

here the connection is successful..

But after this

**************************

Statement st = con.createStatement();

ResultSet rs = st.executeQuery("select * from employee");

while (rs.next()) {

response.write(rs.getString(1));

}

*************

i am getting an exception like this ..below...

************************

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'BC_DDDBTABLERT'

*********

can anyone help me...

to resolve this problemm..

with regards..

Kishor.G

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi there

can u tell me how u solve this prob??

thanks

Former Member
0 Kudos

Hello,

I have MSSQL Server too,

InitialContext ctx = new InitialContext();

DataSource src = (DataSource) ctx.lookup("jdbc/MSSQL");

this works but when I try to do the Connection,

Connection con = src.getConnection();

I become this Exception:

com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. DataSource property serverName must be specified.

Can anybody help me?

Patrick

Former Member
0 Kudos

Hi I solved the problem:

You have to go in the VisAdmin-JDBC Connection-Runtime-"mark Your DB Connection"-Additional-"mark SQL Engine Native SQL"

Cheers

Walter

Former Member
0 Kudos

Hi,

I'm facing the same problem - did You solved it? If Yes, PLEASE let me know how...

Greetings Walter

Former Member
0 Kudos

I had a similar issue with jdbc. My guess is that MSSQL handles tables and attributes with case sensitivity. When I tried a select statement with table name in lower case it failed, but when I tried it in Uppercase, it worked fine. Guess I might have created the tables in Uppercase in SQL server. See if it helps!

Regards,

Siva

former_member185954
Active Contributor
0 Kudos

is the tablename correct ? should you use sapr3.employee ?

i am not sure how it works on MSSQL.

also we generally do a rs.movefirst before the while loop.

Regards,

Siddhesh

Former Member
0 Kudos

Hi Kishor,

are your sure you have got the connection properly? I think instead of writing the following look up

DataSource src = (DataSource) ctx.lookup("jdbc/MSSQL");

you should look it up like

DataSource src = (DataSource) ctx.lookup("java:env/jdbc/MSSQL");

just try this and let us know.

Regards,

SG

Vlado
Advisor
Advisor
0 Kudos

The "java:comp/env" prefix is used only from J2EE components to access their JNDI environment.

Former Member
0 Kudos

You mention you setup the JDBC connecton in the VA, did the test execute work correctly in the VA?