oracle调用java程序连sqlserver2005
1、在oracle的sys-sysdba下登陆
写一个java source程序链接sqlserver2005:
create or replace and compile java source named test as
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class excutesql1
{
public static String entry(String str1,String str2) {
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
// 加载jdbc驱动
String a = "0";
String dbURL = "jdbc:sqlserver://localhost:1433;DatabaseName=wb"; // 链接数据库服务和驱动sample
String userName = "sa"; // 用户名
String userPwd = "giap"; // 密码
Connection dbConn;
try {
a = "1";
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
String sql = "insert into ry_jbxx (RYBH,XM) values ('" + str1
+ "','" + str2 + "')";
PreparedStatement pstmt = dbConn.prepareStatement(sql);
pstmt.addBatch();
pstmt.executeBatch();
a = "2";
} catch (Exception e) {
e.printStackTrace();
a = "error";
&n
相关文档:
'-------------------------------------------------------------------以下是登录代码
<%@ page contentType="text/html; charset=gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3 ......
转自
http://blog.pfan.cn/sword2008/13772.html
一、static
请先看下面这段程序:
public class Hello{
public static void main(String[] args){
//(1)
System.out.println("Hello,world!"); //(2)
......
1、使用java.util.ResourceBundle类的getBundle()方法
示例:
String name = "logging"; // the logging.properties file in src root folder
ResourceBundle rb = ResourceBundle.getBundle(name,Locale.getDefault());
// test the rb
String propertyKey = "xxx";
System.out.println(rb.getString(propert ......
package com.project.ajaxs;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Calendar;
import java.uti ......