Database Connection Link
Can I copy data from one table on a database to another identical table on another database?
I've seen people using the '@' to create a link.
Should this work -
INSERT INTO table_copy
SELECT *
FROM table_origional@old_database
You can. You aren't giving a whole lot of detail so using my crystal ball I am GUESSING that your confusion is in thinking that using the @ sign creates the link that allows the reference to the remote table. The @ sign is just the reference to a database link object that you must first create. You are referencing something that doesn't exist in your query (I'm guessing).
Google "oracle create database link". You'll get some examples of how to do this, including this page: http://psoug.org/reference/db_link.html
Similar Messages
-
Error in Check transport tool" DB Connect Link to database failed"
Hello Guys,
I am trying to close a request but I can't , the return this mensage :
<b>"Test call of transport control progam(TP) ended with return code 0232"</b>
when I try to check transport rout, I see the error below :
<b> DB connect Link to database failed
Offline call connect failed </b>
My Database is SQL SERVER 2000
ThanksHai....
Just i want to confirm, was STMS was configured previously,
if No, Configure it .
If yes log-in to the Domain Controller system 000 client, and execute the T-code STMS, From the menu goto Overview -> Systems
you will be displayed all your systems, by selecting one by one system execute " Update Configuration" from SAP System Menu.
Regards
KHS -
Using database connection in a servlet and get errors after 8 hours
Hey,
I'm running a poker script using applet/servlets and it works great. But for some reason about about 8 hours that database layer stops working. At first I thought it was the connections to mySQL that were timing out (because im using connection pooling) but after turning pooling off (I now create the connection each time) I'm still seeing that same error (I can create a connection but when I do an action ex. like a select statment I get an error). What i'm wondering could it be that the driver I load with Class.forName() some how unloads it's self after x amount of time not being used? Not sure if that is it but if anyone could give me some insight that would be great. The Error i recieve is below:
INFO: Database Event:DatabaseController: Error executing database query.
ERROR: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:104)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:144)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:172)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1839)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2784)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2370)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1183)
at com.softnet.database.DatabaseController.executeDatabaseQuery(DatabaseController.java:190)
at com.softnet.games.GameServer.validateUser(GameServer.java:438)
at com.softnet.games.GameServer.handleData(GameServer.java:113)
at com.softnet.network.HttpConnectionThread.run(HttpServletListener.java:191)
** END NESTED EXCEPTION **
I know the query is good because it works all other times just not after about 8 hours.
--Z3r0CooLHey,
Thanks for the responces. For the connection pooling I would open 5 connections and keep them open. So i though maybe after 8 hours after not being used they would timeout. Thats why i turned off conection pooling and create a new connection each time. Anyways i'll post the code below incase i made a mistake somewhere.
package com.softnet.database;
/************************ DatabaseControler **************************/
import java.sql.*;
import java.util.*;
import com.softnet.database.DatabaseConnectionPool;
import com.softnet.database.DatabaseSettings;
public class DatabaseController
implements DatabaseListener
//Used to make sure the database driver is loaded
private boolean databaseDriverState = false;
//Used to store a database connection
private Connection databaseConnection = null;
//If to user connection pooling or not
private boolean useConnectionPooling = false;
//Used to hold the connection pool varible
private DatabaseConnectionPool connectionPool = null;
//Used to store database settings
private DatabaseSettings databaseSettings;
//Used to hold the DatabaseController listeners
private List databaseControllerListeners = new ArrayList();
//min number of connections for connection pool
private int minNumberOfConnections = 1;
//max number of connections for connection pool -1 is unlimited
private int maxNumberOfConnections = -1;
//DatabaseController Constructors
public DatabaseController(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
public DatabaseController(DatabaseSettings databaseSettings, boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
this.databaseSettings = databaseSettings;
this.useConnectionPooling = useConnectionPooling;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
if(useConnectionPooling == true)
connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
connectionPool.addDatabaseListener(this);
else
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
public DatabaseController() {}
//Database Settings Get/Set
public DatabaseSettings getDatabaseSettings()
return databaseSettings;
public void setDatabaseSettings(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
//Connection Pooling Get/Set
public boolean getConnectionPooling()
return useConnectionPooling;
public void setConnectionPooling(boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
this.useConnectionPooling = useConnectionPooling;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
if(useConnectionPooling == true)
if(connectionPool == null)
connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
connectionPool.addDatabaseListener(this);
else
if(connectionPool != null)
connectionPool.destroyConnections();
connectionPool.removeDatabaseListener(this);
connectionPool = null;
//Return if there connected
public boolean isConnected()
boolean isConnected;
if(databaseConnection != null)
isConnected = true;
else
isConnected = false;
return isConnected;
//Used to connect to database or get a connection for the connection pool
public void connect()
if(databaseDriverState == false)
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//If we dont have a current connection, make one
if(databaseConnection == null && databaseDriverState == true)
if(useConnectionPooling == false)
try
databaseConnection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch (SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error connecting to database. \nERROR: " + sqle.getMessage());
databaseConnection = null;
else
databaseConnection = connectionPool.getConnection();
//Used to disconnect from the database or give back the connection to the connection pool
public void disconnect()
if(databaseConnection != null)
if(useConnectionPooling == false)
try
//Close DB Connection
databaseConnection.close();
catch(SQLException ignore) {}
finally
databaseConnection = null;
else
connectionPool.returnConnection(databaseConnection);
databaseConnection = null;
public ResultSet executeDatabaseQuery(String sSQL)
ResultSet databaseResult = null;
if(databaseConnection != null)
try
Statement databaseStatement = databaseConnection.createStatement();
databaseResult = databaseStatement.executeQuery(sSQL);
catch(SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error executing database query.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
return databaseResult;
public int executeDatabaseUpdate(String sSQL)
int rowsAffected = -1;
if(databaseConnection != null)
try
Statement databaseStatement = databaseConnection.createStatement();
rowsAffected = databaseStatement.executeUpdate(sSQL);
catch(SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error executing database update.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
return rowsAffected;
//Used to load the Database Driver
private boolean loadDatabaseDriver(String databaseDriver)
boolean driverLoaded;
if(databaseDriver.equals("") == false)
try
//Load Database Driver
Class.forName(databaseDriver).newInstance();
driverLoaded = true;
catch (Exception e)
//Raise event
raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + e.getMessage());
driverLoaded = false;
else
driverLoaded = false;
return driverLoaded;
//Wrap the DatabaseConnectionPool Error to the DatabaseController
public void databaseEventOccurred(DatabaseEvent de)
raiseDatabaseEvent(de.getErrorMessage());
//Event Handling Code
//Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
public synchronized void addDatabaseListener(DatabaseListener databaseControllerListener)
databaseControllerListeners.add(databaseControllerListener);
//Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
public synchronized void removeDatabaseListener(DatabaseListener databaseControllerListener)
databaseControllerListeners.remove(databaseControllerListener);
//Used to send the raise event to the listeners
private synchronized void raiseDatabaseEvent(String databaseError)
DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
Iterator listeners = databaseControllerListeners.iterator();
while(listeners.hasNext())
DatabaseListener listener = (DatabaseListener) listeners.next();
listener.databaseEventOccurred(databaseEvent);
/********************* DatabaseConnectionPool **************/
package com.softnet.database;
import java.io.*;
import java.sql.*;
import java.util.*;
import com.softnet.database.*;
import com.softnet.database.DatabaseSettings;
public class DatabaseConnectionPool
//min number of connections
private int minNumberOfConnections = 1;
//max number of connections -1 is unlimited
private int maxNumberOfConnections = -1;
//Store the connections
protected Hashtable databaseConnections = null;
//Database Info
protected DatabaseSettings databaseSettings;
//to hold Driver state
private boolean databaseDriverState = false;
//To hold connection checker
private DatabaseConnectionCheck connectionChecker = null;
//Used to hold the DatabaseConnectionPool listeners
private List databaseConnectionPoolListeners = new ArrayList();
public DatabaseConnectionPool(DatabaseSettings databaseSettings, int minNumberOfConnections, int maxNumberOfConnections)
this.databaseSettings = databaseSettings;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
//Load Driver
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//Create connection
createConnections();
public DatabaseConnectionPool(int minNumberOfConnections, int maxNumberOfConnections)
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
//Database Settings Get/Set
public DatabaseSettings getDatabaseSettings()
return databaseSettings;
public void setDatabaseSettings(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
//Driver State Get
public boolean getDatabaseDriverState()
return databaseDriverState;
public void createConnections()
if(databaseDriverState == false)
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//Create all connections and load the minimum in the Hashtable
if(databaseConnections == null)
if(databaseDriverState == true && minNumberOfConnections != 0)
databaseConnections = new Hashtable();
for(int i = 0; i < minNumberOfConnections; i++)
try
databaseConnections.put(DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword()), Boolean.FALSE);
catch(SQLException sqle)
//Problem break loop and destroy any connections
destroyConnections();
//Raise event
raiseDatabaseEvent("DatabaseConnectionPool: Error creating database connections. \nERROR: " + sqle.getMessage());
break;
//If no connection check exists create one
if(connectionChecker == null)
connectionChecker = new DatabaseConnectionCheck(this);
connectionChecker.start();
public Connection getConnection()
Connection connection = null;
boolean errorWithConnection = false;
Enumeration connections = databaseConnections.keys();
synchronized (databaseConnections)
while(connections.hasMoreElements())
errorWithConnection = false;
connection = (Connection) connections.nextElement();
Boolean state = (Boolean) databaseConnections.get(connection);
//If connection is not used, use it.
if(state == Boolean.FALSE)
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
// Update the Hashtable to show this one's taken
databaseConnections.put(connection, Boolean.TRUE);
// Return the connection
return connection;
//All connections being used check to max to see if we can make a new one
if(maxNumberOfConnections == -1 || maxNumberOfConnections > databaseConnections.size())
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
databaseConnections.put(connection, Boolean.TRUE);
return connection;
//If not connections free and max connections reached wait for a free connection
return getConnection();
public void returnConnection(Connection connection)
boolean errorWithConnection = false;
//Make sure connection still works
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
databaseConnections.put(connection, Boolean.FALSE);
public void destroyConnections()
Connection connection = null;
if(databaseConnections != null)
//Close all connections
Enumeration connections = databaseConnections.keys();
while (connections.hasMoreElements())
connection = (Connection) connections.nextElement();
try
connection.close();
catch(SQLException ignore) {}
//Free up hashtable
databaseConnections = null;
private boolean loadDatabaseDriver(String databaseDriver)
boolean driverLoaded;
if(databaseDriver.equals("") == false)
try
//Load Database Driver
Class.forName(databaseDriver);
driverLoaded = true;
catch (ClassNotFoundException cnfe)
//Raise event
raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + cnfe.getMessage());
driverLoaded = false;
else
driverLoaded = false;
return driverLoaded;
//Event Handling Code
//Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
public synchronized void addDatabaseListener(DatabaseListener databaseConnectionPoolListener)
databaseConnectionPoolListeners.add(databaseConnectionPoolListener);
//Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
public synchronized void removeDatabaseListener(DatabaseListener databaseConnectionPoolListener)
databaseConnectionPoolListeners.remove(databaseConnectionPoolListener);
//Used to send the raise event to the listeners
private synchronized void raiseDatabaseEvent(String databaseError)
DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
Iterator listeners = databaseConnectionPoolListeners.iterator();
while(listeners.hasNext())
DatabaseListener listener = (DatabaseListener) listeners.next();
listener.databaseEventOccurred(databaseEvent);
class DatabaseConnectionCheck extends Thread
private DatabaseConnectionPool connectionPool;
DatabaseConnectionCheck(DatabaseConnectionPool connectionPool)
this.connectionPool = connectionPool;
public void run()
try
while(true)
//check threads every 30 seconds
this.sleep(300000);
if(connectionPool.databaseConnections != null)
Connection connection = null;
Enumeration connections = connectionPool.databaseConnections.keys();
synchronized (connectionPool.databaseConnections)
while(connections.hasMoreElements())
connection = (Connection) connections.nextElement();
Boolean state = (Boolean) connectionPool.databaseConnections.get(connection);
//If connection is not used, use it.
if(state == Boolean.FALSE)
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
connectionPool.databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(connectionPool.databaseSettings.getDatabaseURL(), connectionPool.databaseSettings.getUserName(), connectionPool.databaseSettings.getUserPassword());
catch(SQLException sqle)
connection = null;
// Update the Hashtable with new connection if its not null
if(connection != null)
connectionPool.databaseConnections.put(connection, Boolean.FALSE);
catch(InterruptedException ignored) {}
Basicly the why it works is the connection pool hold the database connections. When the user needs a connection they use the database controller to request a connection (By create a instance and called the connect() method) and the connection is either created or grabed from the connection pool. After the user is done with the connection they call the disconnect() method which closes the connection or returns it to the connection pool.
--Z3r0CooL -
Error during database connection to the database : MS SQL Server 2008 R2
Hi All,
I am working with ABAP Proxy to Rec JDBC( Integrating XI with MS SQL Server 2008 R2). I am using SAP PI 7.0
I am getting error in RWB at communication channel monitoring :
Error during database connection to the database URL 'jdbc:microsoft:sqlserver://10.1.92.111:1433;database=XONTUSERVENTURA_ORG_TEST' using the JDBC driver 'com.microsoft.jdbc.sqlserver.SQLServerDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:microsoft:sqlserver://10.1.92.111:1433;database=XONTUSERVENTURA_ORG_TEST': SAPClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver'
I have given Connection details at Rec JDBC Communication channel as :
JDBC Driver as : com.microsoft.jdbc.sqlserver.SQLServerDriver
Connection : jdbc:sqlserver://10.1.92.111:1433;database=XONTUSERVENTURA_ORG_TEST.
Please help me in this regard. I really appreciate your valuable information and time.
Thanks and Regards,
Ayub.
Edited by: Ayubsajjid on Feb 15, 2012 8:49 AMHi All,
Thanks for all your valuable inputs on my question...
As per all your inputs, we have to install/Deploy the below required jar files in the aii_af_jmsproviderlib.sda file
ojdbc14.jar
msbase.jar
mssqlserver.jar
msutil.jar
Can you please tell me from where we will exact this .jar file, bcoz we have search lotzz but we helpless.
We install from this link http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21599--> we download sqljdbc_3.0.1301.101_enu file >sqljdbc_3.0>enu-->in that I find sqljdbc.jar and sqljdbc4.jar files only . I cant above said .jar files.
Please help me.
Regards,
Ayub. -
BEST PRACTICES FOR CREATING DISCOVERER DATABASE CONNECTION -PUBLIC VS. PRIV
I have enabled SSO for Discoverer. So when you browse to http://host:port/discoverer/viewer you get prompted for your SSO
username/password. I have enabled users to create their own private
connections. I log in as portal and created a private connection. I then from
Oracle Portal create a portlet and add a discoverer worksheet using the private
connection that I created as the portal user. This works fine...users access
the portal they can see the worksheet. When they click the analyze link, the
users are prompted to enter a password for the private connection. The
following message is displayed:
The item you are requesting requires you to enter a password. This could occur because this is a private connection or
because the public connection password was invalid. Please enter the correct
password now to continue.
I originally created a public connection...and then follow the same steps from Oracle portal to create the portlet and display the
worksheet. Worksheet is displayed properly from Portal, when users click the
analyze link they are taken to Discoverer Viewer without having to enter a
password. The problem with this is that when a user browses to
http://host:port/discoverer/viewer they enter their SSO information and then
any user with an SSO account can see the public connection...very insecure!
When private connections are used, no connection information is displayed to
SSO users when logging into Discoverer Viewer.
For the very first step, when editing the Worksheet portlet from Portal, I enter the following for Database
Connections:
Publisher: I choose either the private or public connection that I created
Users Logged In: Display same data to all users using connection (Publisher's Connection)
Users Not Logged In: Do no display data
My question is what are the best practices for creating Discoverer Database
Connections.
Is there a way to create a public connection, but not display it in at http://host:port/discoverer/viewer?
Can I restrict access to http://host:port/discoverer/viewer to specific SSO users?
So overall, I want roughly 40 users to have access to my Portal Page Group. I then want to
display portlets with Discoverer worksheets. Certain worksheets I want to have
the ability to display the analyze link. When the SSO user clicks on this they
will be taken to Discoverer Viewer and prompted for no logon information. All
SSO users will see the same data...there is no need to restrict access based on
SSO username...1 database user will be set up in either the public or private
connection.You can make it happen by creating a private connection for 40 users by capi script and when creating portlet select 2nd option in Users Logged in section. In this the portlet uses there own private connection every time user logs in.
So that it won't ask for password.
Another thing is there is an option of entering password or not in ASC in discoverer section, if your version 10.1.2.2. Let me know if you need more information
thnaks
kiran -
I can't get a database connection.
Background: I've already built two sites with databases using DW CS6, PHPMySQL, and the same hosting company, so I know they allow remote connections. (I'm developing using the remote host because I've never found a tutorial for how to move it all from local XAMPP to my host - but hey, it's been working fine so far.)
I set up the database using CPanel Databases, added the user and password, no problem. Went into PHP MySQL and added a table, logged out and back in, the table is there as defined.
In DW, I double-checked the testing server, tested the connection, and it connected successfully.
Then I opened a page for editing and added a database connection (all as I had done on the previous two sites that work fine). I named the connection, entered the user, the password and tried to SELECT a database. No luck. HTTP Error 404. I manually added the database (the only one) and clicked test. Again no luck. HPPT Error 404.
I double checked the testing server, double checked the DB information, and nothing seems to work.
Any clue what I'm doing wrong? Thanks so much if you can help.UPDATE:
Okay, this is really getting weird. As a typcial computer nerd, I know there are many roads to success, so if one doesn't work, try another.
Trying a different solution, I opened a test.php page and wrote the following code:
<?php
echo "<p>Now testing database connection.</p>\n";
$db_server = "localhost";
$db_username = "mcsb831_mbradmin";
$db_password = "***(redacted)***";
$link = mysql_connect($db_server, $db_username, $db_password);
if (!$link) {
echo "Could NOT connect.<br />\n";
}else{
echo "Connected Successfully.<br />\n";
mysql_close($link);
I loaded the page to the server and guess what? I got the message "Connected Successfully."
Hooray! Now I know the database server is running, and the database and user name and password are valid.
I went to the DW MbrConnect01.php file (the name of the CONNECTION file that Dreamweaver creates when I tried to make the connection through DW), and verified the database name, user name, and password were correct -- I copied and pasted them from the code above to make absolutely certain there were no transcription errors. Here's that file:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_MbrConnec01 = "localhost";
$database_MbrConnec01 = "mcsb831_members";
$username_MbrConnec01 = "mcsb831_mbradmin";
$password_MbrConnec01 = "***(redacted)***";
$MbrConnec01 = mysql_pconnect($hostname_MbrConnec01, $username_MbrConnec01, $password_MbrConnec01) or trigger_error(mysql_error(),E_USER_ERROR);
?>
And guess what?
I GOT THE STINKING ERROR MESSAGE AGAIN!!
(See previous post for the full text of the message.
Yes, I checked the server using an FTP browser for the presence of the required files, and they are there.
Does anyone have a clue what's going on here? I would absolutely love to use DW's DB automation tools, but none of them will work if I can't get a DW connection to work.
I notice that my code uses mysql_connect while the DW-generated code uses mysql_pconnect (which is deprecated), could that be the culprit? How do I fix it if so?
PLEASE, can someone help? -
Please tell how to store jpeg images in SQL Server using NI Database Connectivity Toolset.
http://www.w3schools.com/sql/sql_datatypes.asp
You setup a field as BLOB and store the binary of the picture there. Depending on the database it can be called differently as you can see in the link, in SQL server there's even a Image datatype.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV -
Export to PDF from populated c# Dataset without Database connection
I have Crystal Reports Developer Full version 11.5.12.1838, all versions of Visual Studio and about 100+ reports targeting printed paper.
They were developed over the last decade with the Developer Designer (and it's predecessors) and are based on SQL Server Stored Procedures. In the past, they were produced at runtime using a MS Access VBA application that either printed them or exported them to PDF files. I have successfully converted that application to C#, however a few problems: despite loading a populated dataset and setting all parameters, the runtime still wants to refresh the dataset. That works for 95% of all reports, but some just use null values for the parameters (despite having set them correctly), others mix the sequence of the parameters (despite querying them correctly) and some don't use the provided credentials. But that is not the main problem.
Now I need a way to produce (export to PDF) these reports at runtime based on a populated C# Dataset without database connectivity for the Crystal environment. The structure of the data in the Dataset is identical to what the stored procedure return in the development environment.
The question is: is that possible and what do I need in terms of version, SDK etc. Any advice (sample links) would be much appreciated.Hi Ludek;
Thanks for the hints. After many many hours of research and trial and error here are my findings:
Assigning a dataset to CR does NOT work - seems CR is just ignoring it completely. What does (partially) work is assigning a DataTable, however, if you try to do that with a main report and more than ONE sub-report, it fails with likely unrelated error messages (not yet implemented).
I took one of my reports and deleted all sub-reports. Assigned a DataTable at runtime - works fine. Added one sub-report that has a single field (picture) and loaded at runtime with a DataTable. No problem.
Removed that subreport and added another subreport that has a single text field. All good.
Now: having both sub-reports and having both subreports loaded from a DataTable fails. It works if one of the datasets is empty. It also works with 2 sub-reports returning text into their single field.
The DataTables are populated from the exact same stored procedures (and data source) that are embedded in the report from the design (CR XI) - essentially this should be a swap from internal to external fetch with no consequences.
I tried assigning using subDocument.SetDataSource and subDocument.Databas.Tables[0].SetDataSource - no difference.
The background of this: all my reports work just fine using VBA (Access), but that app will be retired and replaced by something C# based. In the meantime, the same report file has to work with both engines.
If I cannot get the DataTable assignment for sub-reports to work, there is a plan-b type possibility: replacing the stored procedure for some sub-reports at runtime - which works using SubReport.Database.Tables[0].Location.= "newSPName" as long as the new sp has no parameters like the old one.
The problem is that the new procedure has 2 parameters and I did not find a way to add them to the parameters collection (not allowed in sub-reports)
Anything that comes to your mind ?
Any help will be much appreciated
Thanks
Rolf -
Set SSIS variable = database connection manager name
Is it possible to set a SSIS string to only the name of a database connection manager or even the connection string it uses ? I don't see an option for that in Evaluate as expression property of ssis variable.
This is what I mean -
SSIS Connection manager name = SQL_DBASE
SSIS String str_managerName = SSIS Connection manager name: Can you do this dynamically in SSIS ?I'm guessing what they really want to do is evaluate some indicator (some input from a user or an infrastructure setting) and then dynamically connect to any one of 10 (arbitrary example) database servers based on what they get as input. They
don't care about the connection manager per se. What seems reasonable is the that the Connection Manager might take a server variable but if they wanted to do things like that they would have bought Datastage.
You might try attacking this problem at the Control Level and then connect to the database you want based on a variable you set. I'm seeing that a Sequence Container can branch on the contents of a variable.
Or if the dba is your friend you might get the dba to add all your servers as linked servers to a central connection machine and then you might be able to do this by putting the ssis variable in a "Sql Command from a Variable" variable.
It might look something like this:
Server is designated in ssis var @[User::Machine]
then executing from a variable
"select top 100 * from " + @[User::Machine] + ".mydb.dbo.mytable"
Be careful as hades about levels of indirection and what quotes you want at what level. Evaluate Expression in ssis helps with this. The syntax I show works only with an ms sql connection server to a remote ms sql server. This is what a
dynamic connection to a linked server connection to Oracle would look like:
"select * from
openquery("+ @[User::Machine] + ",'select * from oradb.oratable where rownum < 100')"
When ever a thousand of your best friends are helping you connect to your database (using tools like linked servers as opposed to direct connections) it's probably best to use with only small specific updates or queries, large queries or large
updates would probably take a long time and or might not finish. But try it before you give up. We are actually doing fairly large Oracle queries (5-10 million rows) through ms sql linked server. -
ADF Database Connection at Runtime
Hi,
I have developed a ADF based Web Application, deploy the code into different appServers [connecting to Different Databases] but unable to connect to the Required Database at Runtime.
I have the following in my dataSources.xml & web.xml which looks like this.
dataSources.xml
<managed-data-source connection-pool-name="AIAQueryConnectionPool" jndi-name="jdbc/AIAQueryDataSource" name="AIAQueryDataSource"/>
<connection-pool name="AIAQueryConnectionPool">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="aia" password="aia" url="jdbc:oracle:thin:@//occf09.techmahindra.com:1521/ftsit"/>
</connection-pool>
web.xml
<resource-ref>
<description>AIA data source connection for FastTelco</description>
<res-ref-name>jdbc/AIAQueryDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
deployed the web Application "TestTransaction" and created ConnectionPool & DataSources for this Application "TestTransaction"
when i run the Application i am unable to connect to the required Database/(s)
Is that correct what i was doing ?
BUT If i have the entry of that specific Database in ./model/common/bc4j.xcfg file i am able to Connect to the Database
and if i remove the entry from ./model/common/bc4j.xcfg file, I am unable to Connect to the Database.
Why is it so ??
Can anybody give me the process / code to Connect to the Database in web based ADF Application at Runtime.
or
Pick up the Database Configuration Values from a Properties file and establish a Database Connection ??
thanks in Advance...
regards,
anvv sharmaHi,
I got it working today and not yes'day to the modifications suggested by arun...the only difference being i have stop / start the Application then it started with the working what i have done yes'day
also thanks for shay....... it was useful link
regards,
anvv sharma -
Closed database connection in olap worksheet
i have installed analytic workspace manager after applying the pathches ,i tried to log in analytic workspace manager and connect to olap worksheet it gives
me an error as "closed database connection" .My patch
installation was successful and it did not give me any error and my database is also working properly.could anyone help me out with this problem.I had the same problem. Follow this link for the solution
Re: Cannot connect to AWM -
Hi, I want to do an applet where I can connect to a SQL server via an ODBC. The whole conencting to the database works fine with an application, but access is denied when I use an applet ( ie. I have a separated class that do the databases connections and it failed when I use an applet).
Somebody told me that I have to create a java.policy file for users and signed the applet with .jar. but I'm not familiar with either signing a jar(I'm not familiar with the .jar at all) and I'm not familiar either with the java.policy file. Can anyone explain this to me plz?signed the applet with .jar. but I'm not familiar with either signing a jar(I'm not familiar with the .jar at all)So...., check out the link shown below.
http://developer.java.sun.com/developer/qow/archive/167/index.jsp
;o)
V.V.
PS: remember me? -
Why the err Invalid database Connection -CR 11 version in Visual studio 1.1
Hai all,
I am new to using the Crystal report with Visual studio 2003.I am facing Invalid database connection problem. My objective is tyring to upgrade CR 8 to CR11 with VS 1.1 framework(VC++ in .NET 2003).All things like ODBC connection with MS SQL server 2005,generating report going fine with CR8 version but invalid database connection error comes with CR11 version. The configuration details and Code snippet are below for your ref,
Upgrading CR8 to CR11 with VS .NET 2003.
Application framework - VS 1.1 framework
CR - 11 Version
DB - MS SQL server 2005
Connection - ODBC
DLL - CRPE32 DLL (Version11)
Code snippet:
CODBCDatabase * pDatabase = pApp->GetDatabase();
BOOL bRes;
bRes = ::PELogOnSQLServerWithPrivateInfo(_T("pdsodbc.DLL"), pDatabase->m_hdbc);
Note: pdsodbc dll not found in local and anywhere.But it supports CR 8 but not CR 11.So i downloaded and put it in appropriate place exe path\system32\system and tested.Used and tested p2sodbc dll also but "Invalid DataBase connection" err came.Followed some instruction like changing the Data source name,DSN path,re installing CR 11 version and all but same problem coming.
::PELogOnSQLServerWithPrivateInfo() declation is in the following link
http://www.arcaretentores.com.br/FTP/Format/Report/ProgramF/SEAGAT~1/CRW/DEV/Help/HTML/12a_0708.htm
Thanks in advance
Regards
SatheeshKumar
India.Thanks for your reply
The API i have given is not available in Crystal report 11.So i tried with the PELogonServer API of version 11.It also failed.
I am unable to understand the suggestions you gave to me 1) The Report Designer Component (RDC)
2) The CR Assemblies for .NET.
Can you give any link that have related samples or articles to implement the above topics please?
Thanks again,
Satheesh Kumar.D -
Database connection problem in Oracle 8.1.6
Hi,
I have a program which was written in C++ and Pro*C for UNIX. I didn't use runtime context for database connection.The program runs ok under Oracle 8.0.4. When compiled and run under Oracle 8.1.6 I got a "libc internal error - _rmutex_unlock not held" error. This error occurs only when "EXEC SQL CONNECT :loginName " is called.
I wonder if we always have to create a runtime context for connection under Oracle 8.1.6 ?
Thanks in advance for your help.
HarryI had the same symptom from a multithreaded C++ application
until I added the -mt option to the CC command when linking.
You are supposed to use it for compiling, too.
Louis Warshawsky
Computer Associates -
Connecting/Linking MS Access 97 to Oracle Discoverer 4.1
Can someone help me connect/link ms access to Discoverer
I want to run reports from ms access via Discoverer.
Instructions in simple step by step please.Have you tried using the Oracle Migration Workbench? It's
designed to convert various database formats to Oracle.
Hopefully, it'll handle all these sorts of things automagically.
Justin
Maybe you are looking for
-
Sync - merge - what EXACTLY do these terms mean?
Howdy. I recently plunged into the iPhone world & I'm LOVING IT!!!!!! So, what exactly does SYNC & MERGE mean? what will be the final results? with my iPod shuffle, I'm able to "auto fill" from a folder of pre-selected podcasts in iTunes. After liste
-
Battery went from lasting days to hours...bluetooth just added
I just got bluetooth set up in my car through the stereo. My battery now lasts less than a day. Does having bluetooth on at all times effect batter life that significantly? A month ago I set by backlight to the lowest level and I was impressed how I
-
Where are actions stored?
When I first started using PS I didn't install actions correctly now I don't know where any of those actions are stored. I searched for ATN files but only found the actions that I know that installed right. Is there a way to send action from PS ont
-
ATV 2 - iTunes Match stops playing after a few songs
I have iTunes match and it will abruptly stop after playing a few songs. It will reboot the ATV 2. Same thing happens if I'm airplaying from my iPad 2 or iPhone 5. However if I'm airplaying my sound from my Mac to the ATV 2 and playing songs through
-
HT4157 Can't find the Cellular data option on my iPad
Can't find the Cellular Data option on my iPad but can see it on iPhone 4S