on 11-12-2007 8:19 AM
hi all,
i got this error while connecting to my MSSQL database. My MSSQL database is already attach to the ODBC. but when i try to do a login page and run. it give me an error: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of dbname.
the following is my code:
//@@begin onActionGLogin(ServerEvent)
String name = wdContext.currentLoginElement().getUserID();
String password = wdContext.currentLoginElement().getPassword();
try{
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/dbname");
Connection con=ds.getConnection();
Statement st=con.createStatement();
ResultSet rs = st.executeQuery("Select * FROM FinanceOfficer WHERE userID = '"name"' AND password = '"password"';");
if(rs.next()== false){
wdComponentAPI.getMessageManager().reportException("Invalid UserID and Password!",true);
}else{
wdThis.wdFirePlugToBackEnd();
}
}catch (Exception e)
{wdComponentAPI.getMessageManager().reportException(e.toString(),true); }
i also have another qn. the blog link that u gave me teach us how to retrieve database content to the table view. But where do i insert those code? at a particular method or? thx alot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Ayyapparaj KV ,
from ur previous entry, u told me that i can actually insert it in the wdDoInit() of the controller. So it means that the table is dynamically created?
What if i have a table that is manual created and bind it to the context attribute? Is that a step by step tutorial to guide me through or anyone who can help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Ayyapparaj KV,
do u have a step by step guide to teach me hw to configure it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Open Visual administrator, /usr/sap/<instance name>/JC00/j2ee/admin/go.bat
Navigate to server > services > JDBC connector > drivers in runtime tab
Click create new driver and specify a name, eg SQL Server)
Point to 3 .jar files which was installed by the MS jdbc driver before. The files are: msbase.jar, mssqlserver.jar and msutil.jar
The driver installation is now completed
Create datasource
Click DataSources in the same path as above (server > services > JDBC connector)
Click new driver or datasource.
Fillout the following properties:
o Main tab > DataSource Name: fx MyDatasource
o Main tab > Add Alias: fx MyAlias
o Main tab > Driver Name: SQL Server
o Main tab > JDBC version: 2.0 (with XA support)
o Main tab > Object factory: com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory
o Main tab > DataSource Type: ConnectionPoolDataSource
o Main tab > CPDS classname: com.microsoft.jdbcx.sqlserver.SQLServerDataSource
o Additional tab > add property serverName = <your server>, fx localhost
o Additional tab > add property databaseName = <your db>, fx Northwind
o Additional tab > add property portNumber = <port>, fx 1433
o Additional tab > add property user = <sql database user>, fx sa
o Additional tab > add property password = <password>
Save and restart J2EE. The datasource is now ready to use.
/people/anilkumar.vippagunta2/blog/2007/02/20/reading-and-writing-images-from-sqlserver-in-webdynpro
Regards
Ayyapparaj
Hi
Did you create jdbc/dbname this DataSource in Visual Admin.
Refer this blog /people/anilkumar.vippagunta2/blog/2007/02/20/reading-and-writing-images-from-sqlserver-in-webdynpro
for the creation
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
26 | |
10 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.