如何使用PLSQL连接服务器上的数据库,开发初学者都需要会这个问题。下面说一下步骤,帮助大家配置host并成功查询数据。
1、首先鼠标右键PLSQL,选择属性,打开PLSQL所在文件夹位置。
2、在文件夹中,找到instantclient文件夹。这里将该文件移出到PLSQL安装文件外,方便之后修改。
3、然后在instantclient下,找到tnsnames.ora,用编辑器打开。
4、在tnsnames.ora中,可以配置数据库连接。数据库名称、协议类型、host、port、sid。配置好之后,保存。
5、打开PLSQL,输入username、password,选择到配置的数据库,进行连接。点击“file”--“new”--“SQL Window”,打开窗口,输入查询命令,F8执行,连接成功了。
java连线Mysql的连线字串怎么写的import java.sql.*public class SqlUtil{ public static void main(String[] args) {try{ String url="jdbc:mysql:localhost/mydb" String user="root"使用者名称 String pwd="123456"密码 载入驱动,这一句也可写为:Class.forName(".mysql.jdbc.Driver")Class.forName(".mysql.jdbc.Driver").newInstance() 建立到MySQL的连线 Connection conn = DriverManager.getConnection(url,user, pwd) 执行SQL语句 Statement stmt = conn.createStatement()建立语句物件,用以执行sql语言 ResultSet rs = stmt.executeQuery("select * from student") 处理结果集 while (rs.next()) {String name = rs.getString("name") System.out.println(name) } rs.close()关闭资料库 conn.close() }catch (Exception ex){ System.out.println("Error : " + ex.toString()) } }}
jdbc:mysql:localhost:3306/sample_db?user=root&password=browser&useUnicode=true&characterEncoding=UTF-8
汇入mysql的驱动Jar包
Class.forName(".mysql.jdbc.Driver")
Connection con = null
String url = "资料库的url"
String user = "资料库登入名"
String password = "资料库密码"
con = DriverManager.getConnection(url, user, password)
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@127.0.0.1:1521:ORCL
字串内容
jdbc:mysql:localhost/资料库名称,“登入名”,“密码”
mysql cluster的hibernate连线字串怎么写
Driver template :选择要连线资料库型别我用mysql选择MYSQL Connector/J Driver name :所建立连线名字,随便写
Driver classname:.mysql.jdbc.Driver要Add JARs选择 .mysql.jdbc.Driver路径显示
使用oracle参考我面式
Dreamweaver连线MySql的连线字串
在Dreamweaver里连线mysql可以不用写连线字串的。
1、建立好站点
2、编辑站点属性-->测试伺服器,右边伺服器模型和访问选择:PHP MySQL,本地/网路
3、应用程式-->资料库一栏里点加号建立MySQL连线
4、连线名称(随意),MySQL伺服器(localhost),使用者名称(root),密码(*******),资料库(你要连线的资料库名,键入或选取都行)
5、测试连线-->确定,即可。
c#连线到mysql 的连线字串怎么写
ODBC DSN
ODBC -- MyODBC Driver -- local database
ODBC -- MyODBC Driver -- remote database
ODBC -- MySQL ODBC 3.51 Driver
OleDb
.NET DataProvider from CoreLab
ODBC DSN
using System.Data.Odbc
OdbcConnection conn = new OdbcConnection()
conn.ConnectionString =
"Dsn=DsnName" +
"Uid=UserName" +
"Pwd=Secret"
conn.Open()
ODBC -- MyODBC Driver -- local database
using System.Data.Odbc
OdbcConnection conn = new OdbcConnection()
conn.ConnectionString =
"Driver={MySql}" +
"Server=localhost" +
"Option=16834" +
"DataBase=DataBaseName"
conn.Open()
ODBC -- MyODBC Driver -- remote database
using System.Data.Odbc
OdbcConnection conn = new OdbcConnection()
conn.ConnectionString =
"Driver={MySql}" +
"Server=db.domain." +
"Option=131072" +
"Port=3306" +
"Stmt=" +
"DataBase=DataBaseName" +
"Uid=UserName" +
"Pwd=Secret"
conn.Open()
ODBC -- MySQL ODBC 3.51 Driver
using System.Data.Odbc
OdbcConnection conn = new OdbcConnection()
conn.ConnectionString =
"Driver={MySql ODBC 3.51 Driver}" +
"Server=ServerName" +
"Option=16834" +
"Port=3306" +
"Stmt=" +
"DataBase=DataBaseName" +
"Uid=UserName" +
"Pwd=Secret"
conn.Open()
or
using System.Data.Odbc
OdbcConnection conn = new OdbcConnection()
conn.ConnectionString =
"DRIVER={MySql ODBC 3.51 Driver}" +
"SERVER=ServerName" +
"DATABASE=DataBaseName" +
"USER=UrerName" +
"PASSWORD=Secret"
conn.Open()
OleDb
using System.Data.OleDb
OleDbConnection conn = new OleDbConnection()
conn.ConnectionString =
"Provider=MySqlProv" +
"Data Source=ServerName" +
"User id=UserName" +
"Password=Secret"
conn.Open()
.NET DataProvider from CoreLab
using CoreLab.MySql
MySqlConnection conn = new MySqlConnection()
conn.ConnectionString =
"Host=ServerName" +
"DataBase=DataBaseName" +
"Protocol=TCP" +
"Port=3306" +
"Direct=true" +
"Compress=false" +
"Pooling=true" +
"Min Pool Size=0" +
"Max Pool Size=100" +
"Connection Lifetime=0" +
"User id=UserName" +
"Password=Secret" +
conn.Open()
Server=localhostDatabase=drive_baseUser=otnp80Password=123Use Procedure Bodies=falseCharset=utf8Allow Zero Datetime=TruePooling=falseMax Pool Size=50
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)