⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registerejb.java

📁 structejbmysql开发工程源码
💻 JAVA
字号:
/*
 * Created on 2007/03/05
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package access.register;

import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Hashtable;

import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import course.data.ChengJi;
import course.data.KeChengChengJi;
import course.data.login.Login;
import course.ejb.login.LoginHome;

/**
 * @author itsuser
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class RegisterEjb {

	private course.ejb.register.RegisterHome getHome() throws NamingException {
		return (course.ejb.register.RegisterHome) getContext().lookup(
				course.ejb.register.RegisterHome.JNDI_NAME);
	}

	private InitialContext getContext() throws NamingException {
		Hashtable props = new Hashtable();

		props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
				"org.jnp.interfaces.NamingContextFactory");
		props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");

		// This establishes the security for authorization/authentication
		// props.put(InitialContext.SECURITY_PRINCIPAL,"username");
		// props.put(InitialContext.SECURITY_CREDENTIALS,"password");

		InitialContext initialContext = new InitialContext(props);
		return initialContext;
	}

	public void InsertCustomer_info(String userName, String userNiName,
			String userPsw, String userPswQus, String userPswAns,
			String userEmail) {

		try {
			course.ejb.register.Register register = getHome().create();
			register.InsertCustomer_info(userName, userNiName, userPsw,
					userPswQus, userPswAns, userEmail);

		} catch (RemoteException e) {
			
			e.printStackTrace();
		} catch (CreateException e) {
			
			e.printStackTrace();
		} catch (NamingException e) {
			e.printStackTrace();
		}

	}
	public String getUserName(String userName) {
		String name=null;

		try {
			course.ejb.register.Register register = getHome().create();

			name = register.getUserName(userName);

		} catch (RemoteException e) {
			
			e.printStackTrace();
		} catch (CreateException e) {
			e.printStackTrace();
		} catch (NamingException e) {
			e.printStackTrace();
		}
		return name;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -