odbc connection for PL/SQL - plsqldeveloper

I'm using PL/sql developer to create table.i used conncetion codings like
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection( "jdbc:oracle:thin:#localhost:1521:test")
ps = con.createStatement();
SQL_Str="Select * from dhanu_demo where uname like ('" + UName +"')"
rs=ps.executeQuery(SQL_Str);
rs.next();
dbusername=rs.getString(1).toString();
dbpassword=rs.getString(2).toString();
now i want to create dsn name through
controlpanal->performance&maintannence->datasource->system domain->?
i dunno which driver i need to select here. can anyone tell me. how to connect my jsf page to PL/SQL database??

For your way of connecting there is no need to create dsn. because it uses the type 4 driver from oracle. Moreover to interact with database in jsf
Check out the following link http://www.mkyong.com/jsf2/jsf-2-0-jdbc-integration-example/

Related

How do you setup a MySQL connection for Orange?

Has anyone ever setup a SQL connection for Orange? The API (https://docs.biolab.si//3/data-mining-library/reference/data.sql.html) does not provide any decent examples, from my read of things. If you could point me to a link or show me an example connection object in Python, that would be great. I am trying to do some CN2 classification on a table in my MySQL database.
It is possible using a ODBC connector:
from pyodbc import connect
connector = connect('Driver={MySQL ODBC 5.3 Unicode Driver};'
'Server=server name or IP;'
'Database=database name;'
'UID=User;'
'PWD=password;')
cursor = connector.cursor() # Creation of the cursor for data swept.
# Execution of the SQL Query.
cursor.execute("SELECT id, data1, data2 FROM table1")
# All data of "table1" are saved in "data".
data = cursor.fetchall()

Difference between "?" and "#" in visual basic

I just want to ask what is the difference between ? and # when inserting data to mysql in visual basic. So I have this query:
Dim sql As String = "INSERT INTO users(firstname, lastname, position) VALUES(?fname, ?lname, ?pos)"
cmd = New MySqlCommand(sql, conn)
cmd.Parameters.AddWithValue("?fname", TextBox1.Text)
cmd.Parameters.AddWithValue("?lname", TextBox2.Text)
cmd.Parameters.AddWithValue("?pos", TextBox3.Text)
I first use the #param but it is not inserting data to mysql but when I use ?param it inserts data. What is the difference between them?
When CommandType is set to Text, the .NET Framework Data Provider for
ODBC does not support passing named parameters to an SQL statement or
to a stored procedure called by an OdbcCommand. In either of these
cases, use the question mark (?) placeholder.
Direct quote from here:
named parameters with .NET Framework Data Provider for ODBC

MySQL ODBC Connection Select Fails

I am trying to do a very simple sql select statement from a MySQL database:
Dim lDatabase As Database = DatabaseFactory.CreateDatabase("FTP")
lSqlString = String.Format(CultureInfo.CurrentCulture, "SELECT monthends.web_usr FROM monthends")
lDBCommand = lDatabase.GetSqlStringCommand(lSqlString)
lUsers = lDatabase.ExecuteDataSet(lDBCommand)
And on the execute dataset line I receive the following ODBC Exception:
In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.
I don't get it. This is the simplest of simple sql statements and it has all worked just fine in the past, why doesn't this work anymore???
Thanks in advance!
What was going on was that there was an incorrect version of the MySQL ODBC 3.5xx driver installed. I contacted the DB Admin and got the correct version, it all works now as it should.

connect to an access .accdb database using a c# activeX object in Windows 7 and CVI 9.0.1

I am trying to connect to an access .accdb database using a 32 activeX object in CVI 9.0.1. I am able to connect just fine to a .mdb file, but when I try .accdb the function goes through just fine, but connectFlag returns a 0 indicating it failed to connect to the file. I am able to use the exact same code in WindowsXP, and it works just fine for both .accdb and .mdb files. I have verified that the access drivers do exist in C:\Windows\SysWOW64\odbcad32.exe
Microsoft Accees Driver (*.mdb, *.accdb) version 14.00.7010.1000
I am also able to connect to the same database on my windows 7 machine using Visual Studio 2010. I also downloaded a trial of CVI SqlTool Kit, and was able to connect to the .accdb database using a DSN. I have also downloaded a copy of CVI 2013 thinking maybe my version only running in 32-bit and not able to see the SysWOW64 folder, however I got the same results in CVI 2013.
I have included the code below....
HRESULT result = 0;
ERRORINFO errorStruct;
char * dbPtr = NULL;
char * SQLptr = NULL;
char * record = NULL;
VBOOL connectFlag;
CAObjHandle databaseObj = 0;
// database connection strings
char dbLocation[] = "DSN=test" ;
char dbLocation[] = "c:\\obsoleteparts.mdb" ;
char dbLocation[] = "c:\\serialnumbers.accdb" ;
char sqlStr[]= "SELECT tblSerialNumbers.serialNumber FROM(tblSerialNumbers) WHERE tblSerialNumbers.prefix='05-' ORDER BY tblSerialNumbers.serialNumber DESC";
prjAxDatabaseObj__Recordset rsObj;
dbPtr = dbLocation;
SQLptr = sqlStr;
errorTxt[0] = 0;
result = prjAxDatabase_New_axDatabase (NULL, 1, LOCALE_NEUTRAL, 0,&databaseObj );
result = prjAxDatabase__axDatabaseConnect (databaseObj, &errorStruct, &dbPtr, &connectFlag);
CA_DisplayErrorInfo (databaseObj,"error",result,&errorStruct)
Code runs just fine, does not display an error, result shows that the operation was a success, however the connectFlag returns a 0 meaning it did not connect. Any suggestions would be much appreciated thanks.
-Justin
Regarding my comment above, I used the following connect strings (when not using DSNs) for all CVI versions:
//giAmsIndex = DBConnect ("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\dev\\DB\\New_AMS_Index.accdb");
//giAmsData = DBConnect (""Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\dev\\DB\\New_AMS_000");
and the following when using DSNs:
hAmsIndex = DBConnect ("DSN=New_AMS_Index");
hAmsData = DBConnect ("DSN=New_AMS_000");
But as I said in the comment, your problem description suggests UAC issues having to do with MS Access.

Cannot switch a connection string in LLBL Gen Pro

I have two databases with the same schema inside a Sql 2008 R2 Server, of which names are Database1 and Database2. I connected and performed queries on the Database1, and then changed to Database2 to fetch my entities using the following code
this.ConnectionString = "Server=TestServer; Database=Database2;Trusted_Connection=true";
using (IDataAccessAdapter adapter = new DataAccessAdapter(this.ConnectionString))
{
var entities = new EntityCollection<T>();
adapter.FetchEntityCollection(entities, null);
return entities;
}
(The connection string was set before executing the code).
I debugged the application and looked at the value of the connection string, it pointed to the Database2.
However, when I executed the above code, the result was return from the Database1. And if I looked at SQL Profiler, the statement was executed against Database1.
So, could anyone know what was going on? Why the query was executed against the Database1, not Database2.
PS: If I used the above connection string with plain ADO.NET, I was able to retrieve data from Database2.
Thanks in advance.
I have figured out what was going on. The reason was: by default LLBL Gen Pro uses fully qualified names like [database1].[dbo].[Customer] to access database objects, and the catalog is specified when generating entities. So you can't access objects just by changing the connection string.
Hence, to change to another database you have to override the default catalogue by using following code
var adapter= new DataAccessAdapter(ConnectionString, false,
CatalogNameUsage.ForceName, DbName)
{CommandTimeOut = TenMinutesTimeOut};
More information can be found at the following link