الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Connection String

بدأه الزرقاء في 13 أكتوبر 2008 · 2 رد · 1,483 مشاهدة · في قسم إدارة قاعدة البيانات أوراكل
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي مشكلة في تحديد الاتصال مع قاعدة البيانات حيث يوجد لدي أكثر من قاعدة بيانات على السرفر

قمت بالدخول إلى الريجستري وعمل String Value ووضع اسم أحدى القواعد لكي تكون افتراضية عند الاتصال

واشتغلت تمام

لكن لما أحب أحصل على الاتصال من الكود

Get_Application_Property(CONNECT_STRING)

لا يظهر اسم قاعدة البيانات لكن تطلع القيمة فاضية

ولا أدري ما سبب المشكلة

:wacko:

#2

You can have the username, password and connect_string in a ini file. In

the ON-LOGON trigger, you can fetch those values login to the database.

Since the ini file will be open to everyone who have access to the folder in

which it is located, you can secure the logon details by encrypting the

password field in the ini file and decrypt it in ON-LOGON trigger.

Create an ini file say connection.ini with the following content :
user_name=base1
password=base1
connect_string=wrun

Below is a procedure which will parse the ini file and return the User Name,
Password and connect string. Its a very simple implementation, you can
enhance it further with encryption, etc.

PROCEDURE Get_Connection_Info(Usr OUT Varchar2, Pwd OUT Varchar2, Conn OUT
Varchar2) IS
FP Text_IO.File_Type;
Tmp_Line Varchar2(4000);
BEGIN
FP := Text_IO.FOpen('Drive:\FilePath\connection.ini', 'r');
Begin
Loop
Text_IO.Get_Line(FP, Tmp_Line);
Exit When Tmp_Line IS NULL;
If SubStr(Tmp_Line, 1, InStr(Tmp_Line, '=') - 1) = 'user_name' Then
Usr := SubStr(Tmp_Line, InStr(Tmp_Line, '=') + 1);
ElsIf SubStr(Tmp_Line, 1, InStr(Tmp_Line, '=') - 1) = 'password' Then
Pwd := SubStr(Tmp_Line, InStr(Tmp_Line, '=') + 1);
ElsIf SubStr(Tmp_Line, 1, InStr(Tmp_Line, '=') - 1) = 'connect_string'
Then
Conn := SubStr(Tmp_Line, InStr(Tmp_Line, '=') + 1);
End If;
End Loop;
Exception
When NO_DATA_FOUND Then
NULL;
End;
Text_IO.FClose(FP);
END;

Write the following code inON-LOGON trigger

Declare
User_Name Varchar2(100);
Pwd Varchar2(100);
Conn_Str Varchar2(100);
Begin
Get_Connection_Info(User_Name, Pwd, Conn_Str);
Logon(User_Name || '@' || Conn_Str, Pwd);
End;
#3

شكراً لك Oracle_DBA

ولكن أنا جربت الاجراء وعندما أقوم بتشغيل الـ Form تظهر شاشة الـ LOGIN من جديد

مع أنني قد قمت بالاتصال بقاعدة البيانات قبل تشغيل الـ Form

مواضيع مشابهة