`

About database Url setting

阅读更多

mysql
drivers=org.gjt.mm.mysql.Driver
logfile=\doc\\lo.txt

mysql.url=jdbc:mysql://localhost/数据库名?useUnicode=true&characterEncoding=8859_1
mysql.maxconn=5
mysql.user=
mysql.password=
mysql.driver=org.gjt.mm.mysql.Driver
mysql.url=jdbc:mysql://218.197.19.113/study?useUnicode=true&characterEncoding=GBK


Oracle
drivers = oracle.jdbc.driver.OracleDriver
url = jdbc:oracle:thin:@localhost:1521:orcl
DB2
drivers = com.ibm.db2.jdbc.app.DB2Driver
url = jdbc:db2://localhost:5000/sample

Informix
drivers = com.informix.jdbc.IfxDriver
url = jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;
user=testuser;password=testpassword


Sql Server7.0/2000
drivers = com.microsoft.jdbc.sqlserver.SQLServerDriver
drivers = sun.jdbc.odbc.JdbcOdbcDriver
url = jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs
url = jdbc:odbc:driver={SQL Server};server=zhl;Database=school

Access
drivers = sun.jdbc.odbc.JdbcOdbcDriver
url = jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\projects\\demo.mdb

for example:

<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//orcl为你的数据库的SID
String user="scott";
String password="tiger";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>

 

分享到:
评论

相关推荐

    WordPress Top Plugins.pdf

    Setting up your About Me Widget 76 Category Posts Widget 77 After the Deadline 79 Using After the Deadline 80 WordPress Mobile Pack 80 Mobile themes 82 Browser detection and domain detection 83...

    Django 1.0 Website Development.pdf

    Setting up the database 20 Launching the development server 22 Summary 23 This material is copyright and is licensed for the sole use by Richard Ostheimer on 15th June 2009 2205 hilda ave., , ...

    X-CART GOLD v3.4.9

    7. Dump of MySQL database is in ./sql/*.sql file. 8. Website images are located in ./*images directory. 9. Shipping modules (integrated) are located in ./shipping directory V. X-CART FILES Top ...

    WordPress 2.9 E-Commerce.pdf

    Setting up a new database 196 Importing your WordPress database 197 Uploading your WordPress files 198 Editing your WordPress config file 199 Man the hatches—essential site security 200 User ...

    drupal 6.12

    result in "Page Not Found" errors, try manually setting the $base_url variable in the settings.php file if not already set. It's currently known that servers running FastCGI can run into problems ...

    Android Cookbook, 2nd Edition 2017年出版766页

    Another communication mechanism is about allowing controlled access to data that is usually in a SQL database. This chapter also shows you how to make application data available to other applications...

    Learning iOS Programming, 2nd Edition.pdf

    setting up your work environment, from installing Xcode and the iOS SDK to generating the developer certificates you’ll need to build your applications and deploy them onto your own iPhone, iPod ...

    Manning.Spring.in.Action.4th.Edition.2014.11.epub

    About this Book 1. Core Spring Chapter 1. Springing into action 1.1. Simplifying Java development 1.1.1. Unleashing the power of POJOs 1.1.2. Injecting dependencies 1.1.3. Applying aspects 1.1.4. ...

    php.ini-development

    url_rewriter.tags ; Default Value: "a=href,area=href,frame=src,form=,fieldset=" ; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" ; Production Value: "a=href,area=href,frame=...

    Python Cookbook, 2nd Edition

    Restricting Attribute Setting Recipe 6.4. Chaining Dictionary Lookups Recipe 6.5. Delegating Automatically as an Alternative to Inheritance Recipe 6.6. Delegating Special Methods in Proxies ...

    TICQClient Version

    ] Added Miranda-icq database support in TICQDb component, see DbType property in Help.chm[+] Added ignore list support, see Server Side Lists in Help.chm[+] Added OnURLFound event in TICQDb[+] Added ...

    cuteEditor6.0

    <br/> 支持相对地址和URL自动关联(Demo) <br/>With Cute Editor, you have the choice of using either a relative or absolute URL. 部署简单 <br/>The perfect addition to your ...

    EurekaLog_7.5.0.0_Enterprise

    15)..Added: Expanding environment variables for "Support URL" 16)..Fixed: Range-check error on systems with MBCS ACP 17)..Fixed: 64-bit shared memory manager may not work 18)..Fixed: Possible "Unit ...

    Digging into WordPress.pdf

    2.3.1 Permalinks: Your URL Structure ............................26 2.3.2 HTAccess .................................................................................27 2.3.3 Which Style of Permalinks? ...

    python3.6.5参考手册 chm

    Python参考手册,官方正式版参考手册,chm版。以下摘取部分内容:Navigation index modules | next | Python » 3.6.5 Documentation » Python Documentation contents What’s New in Python ...

Global site tag (gtag.js) - Google Analytics